The error:
QtPrivate::ExceptionStore::throwPossibleException already defined
in QHttpServerFutureResponse.
Task-number: QTBUG-85191
Change-Id: I055b2aa563cbde7d01309a01fa59d4283c9c2e36
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Provide simple API for asynchronous resoponses
Change-Id: Ic0c92cce95751dc8f9d6b0dfa96e39019f5f5e9e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
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>
It looks like qmake -r does not resolve dependencies correctly.
Change-Id: Ifd6bd6cac9af1b5eee249aef99fd32ed68f72a9e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Coin by default uses dev branch of qtbase.
Add 5.12 qtbase into the dependencies file
Change-Id: I849ea65e36c74f153dbd5531c01e3a3b00ab4fef
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@gmail.com>
According HTTP/1.1 specifications (RFC 7231) CONNECT is intended only
for use in requests to a proxy. That it is why http-parser sets the upgrade flag.
This patch will allow users to decide how to handle this.
Change-Id: Ic2d10ca4ab113b4cac85e14f15af7890d5773e98
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
1. Move initialization of httpParser from QAbstractHttpServer
to QHttpServerRequest.
2. Simplify access to an upgrade header value from a request.
httpParser sets an upgrade flag only if the request has two headers
or the request is HTTP CONNECT method.
Change-Id: I39c2325558a58679e40d38e46706cd61ef36d327
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@gmail.com>
QTcpSocket was created on heap without a parent and it never called
delete.
Change-Id: I492633f9797427e546065f9afadf19a672dc552c
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
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>
When the parser received "CONNECT / HTTP/1.1\n\n", its upgrade variable
is set to 1 even though there is no "upgrade" header available.
In this case, QMap::find() returns its end.
Task-number: QTBUG-82053
Change-Id: I41cc23511459c6735a474bb7b903638dd4b1208f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Locally I was unable to build QSslServer due to
QAbstractSocketEnginePrivate not being exported.
Change-Id: I739b63d03d2ff378e03ef3fcd7b1ab55db24f63b
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@kdab.com>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@gmail.com>
Change-Id: Ibb373e7462220cb678330bb0cb7421407ccb37e3
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
There are few changes:
1. Remove std::function. A lambda can be converted to a function pointer
if it does not capture.
2. Change std::map to std::array and mark it as constexpr. It will
eliminate run-time initialization and checking.
3. Remove unnecessary nesting
Change-Id: I5379cb11016def47aee0c57c3de39677aae072d7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
And disable copy for QHttpServerRequest since it's not intended
to be copy-able.
Change-Id: I34ba6929507cc4f020fac52bf36c816b194fd250
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
GCC 4.8 doesn't like using QPointers in signal connections.
Additional to e35fdc4763a54aff3768bcd0144ae97249bd7185.
Fixes: QTBUG-79345
Change-Id: Id5677139a31affab737d11e4456f9bf8d174601f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
GCC 4.8 doesn't like using QPointers in signal connections.
Fixes: QTBUG-79345
Change-Id: I7cd4d79eee3ce7f07874e13f5ecfa9925090d68d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Currently QHttpServerRouterViewTraits contains all helpers and tools
inside itself. It is hard to read and extend.
This patch:
- Moves all helper and tools to QtPrivate namespace
- Tries to "simplify" template magic
- Adds support for unit test
Change-Id: I6aa443b286c4c896b8dbfee85fffb638328868ad
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Using QSharedPointer rather than raw pointer for private data
[ChangeLog][QHttpServerRequest][Fix QHttpServerRequest memory leak] Fixed: memory leak in QHttpServerRequest
Change-Id: I419ec22e56f199677d058938cee046a60a3c2450
Reviewed-by: Jesus Fernandez <jsfdez@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>
So it doesn't detach from command line on Windows,
and doesn't generate app bundles on macOS.
Change-Id: I0449b1224b9c01f2f040ac98508732f9d280ee3b
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qbc.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@gmail.com>
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>
This is because QHttpServerResponder uses QByteArray for headers' key/
value.
Change-Id: I21b5af4d08e43ee58a1edc95b714c6da0ae10790
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Commit 4f64330b39bd528a84241e976baa464c6dc89de1 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>