This function allows to register a function to be run after each request.
Task-number: QTBUG-77090
Change-Id: I40dd4c1e9a447fbe034149ffc1923c7c814cf0e9
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@gmail.com>
Which then makes it compatible with other listen() functions in Qt
in the sense that doing if (server.listen()) will behave
consistently.
Ports being listened to can then be gotten from the new serverPorts()
function, mirroring serverPort() from QTcpServer etc., except it's a
QVector.
This is a source incompatible change, but is allowed because this
module is still in tech preview.
Fixes: QTBUG-79411
Change-Id: I09764afbf8fd866af4f43ab90fcf9c2e9a373237
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@gmail.com>
Added new `QAbstractHttpServer::sslSetup` which enables HTTPS usage.
Added new `QSslServer` which inherits from `QTcpServer` and configures
incoming TCP clients to use SSL.
[ChangeLog][QHttpServer][Https support] Https support added to
QAbstractHttpServer class
Change-Id: I536cf48b86b246e3f4b9d960f793b93670afe06f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Guy Poizat <gerrit.qt@gmail.com>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@gmail.com>
Add new API for HTTP headers manipulations.
Add QHttpServerResponse::write function which will
allow to write custom response objects in a future.
Fixes: QTBUG-76933
Change-Id: I744303be1b517c07f698c4a3dd2c4296f77e3b03
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@tqcs.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It does not make sense to set "text/html" as content type for empty
responses.
Change-Id: I93f540c97cef38409f1479f1c332349155edd176
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qbc.io>
Currently we have a lot of duplication of most common HTTP headers and their
values.
This patch moves them to one place.
Change-Id: Idf9ddc5164e81649b4cc37ed92a516eb1eedab3a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qbc.io>
Currently QHttpServerResponder is not flexible enough:
- Does not allow to rewrite headers
- Does not allow to write headers without storing them internaly first
- Does not provide API to make your own HTTP response
This patch will help to implement QHttpServerResponse
setHeaders/addHeaders
Change-Id: If9e21f7f7a58629bfedad0f10cab67d67fce0a89
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This is a shortcut for static file contents.
Change-Id: I54d97c60822e661c1405f27ea8d4598f0363b144
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QHttpServer::route accepted the lambda by universal reference, but did
not pass it to QHttpServerRouter::addRule by std::forward.
We can not initialize lambda captures with C++11.
So we always need to copy the lambda by value.
Task-number: QTBUG-74882
Change-Id: I3e2dc6003624414d0ff45ba2e2f1af472e219ff1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Commit 4f64330b39 changes some mime types
of responses to text/plain.
The commit also FIXED the "No newline at end of file" warning in a test
data for QHttpServerResponder.
Change-Id: I9b6b1878a2b61bf80db1e39b81ae75c4cedce615
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QByteArray can be used for any data that QMimeDatabase understands
Change-Id: I17d8f0060065c0a93fc4a8cf6450bdd11aed49d0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
QAbstractHttpServer did not clear a request's internal properties (headers,
url, body).
If a request has a keep-alive header, QAbstractHttpServer should clear the
request's internal properties.
Change-Id: I2dfd0565369bd3291cd8d9900045c5a7f9d43ca3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It is required to have continuous integration enabled in the
repository.
Change-Id: I71728a6e89841640e77c50a05cf59f34d697f897
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QHttpServer provides a simplified interface to QAbstractHttpServer and
QHttpServerRouter.
Change-Id: I884204aa8140bbab4c0d6a8ab4c798e0b2470e29
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>