summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttp2protocolhandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Convert a few sizeof(array)/sizeof(element0) fors to range forsAlbert Astals Cid2019-10-041-9/+6
| | | | | | | | Increases readability Change-Id: I81ea915517fd2cd6bc2780f37ba8d8097c63f44b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* A follow-up to a recent fix in QHttpNetworkConnectionChannelTimur Pocheptsov2019-09-051-0/+25
| | | | | | | | | | | | | | | | | | While working with HTTP/2, we are not re-sending failed requests. In case we receive a GOAWAY frame, we properly handle it by processing some active streams if possible, and aborting streams that will not proceed further with ContentResendError. But it's possible that some server failed to send us GOAWAY (for example, it died) or closed the connection not finishing the streams that were still active and valid (ID <= value from GOAWAY frame). Now that we will not re-connect, there is no reason to be quiet about us not progressing - emit RemoteHostClosedError on any remaining active stream/request we cannot process further. Fixes: QTBUG-77852 Change-Id: I4cd68a1c8c103b1fbe36c20a1cc406ab2e20dd12 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QHttp2Configuration - respect the value returned by huffmanCompressionEnabled()Timur Pocheptsov2019-08-211-0/+1
| | | | | | | | And either compress or not. Task-number: QTBUG-77412 Change-Id: I3b09385d2b3caf4f7de0455ad6e22c0f068c33a9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add means to configure HTTP/2 protocol handlerTimur Pocheptsov2019-08-201-32/+12
| | | | | | | | | | | | | | Similar to TLS configuration that we can use on QNetworkRequest, we can configure different options in our HTTP/2 handling by providing QNetworkAccessManager with h2 configuration. Previously, it was only possible internally in our auto-test - a hack with QObject's properties and a private class. Now it's time to provide a public API for this. [ChangeLog][QtNetwork][QNetworkRequest] Add an ability to configure HTTP/2 protocol Change-Id: I80266a74f6dcdfabb7fc05ed1dce17897bcda886 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-271-2/+23
|\ | | | | | | Change-Id: Ic6cfe08dbda1dc92b969e67063f805df63ba0fcf
| * Implement 'preconnect-https' and 'preconnect-http' for H2Timur Pocheptsov2019-07-241-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QNetworkAccessManager::connectToHostEncrypted()/connectToHost() creates 'fake' requests with pseudo-schemes 'preconnect-https'/ 'preconnect-http'. QHttp2ProtocolHandler should handle this requests in a special way - reporting them immediately as finished (so that QNAM emits finished as it does in case of HTTP/1.1) and not trying to send anything. We also have to properly cache the connection - 'https' or 'http' scheme is too generic - it allows (unfortunately) mixing H2/HTTP/1.1 in a single connection in case an attribute was missing on a request, which is wrong. h2c is more complicated, since it needs a real request to negotiate the protocol switch to H2, with the current QNetworkHttpConnection(Channel)'s design it's not possible without large changes (aka regressions and new bugs introduced). Auto-test extended. Fixes: QTBUG-77082 Change-Id: I03467673a620c89784c2d36521020dc9d08aced7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Remove property usage in QHttp2ProtocolHandlerTasuku Suzuki2019-06-291-6/+18
|/ | | | | | | This helps to fix build without feature.properties Change-Id: Ia1fd2a1ca88105048e75694874058bb1292899a0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* HTTP2: Fix handling of GOAWAY framesChristian Kamm2019-05-031-1/+8
| | | | | | | | | | | | Previously there were two issues: - A QNetworkReply could be aborted but be in NoError state. (GOAWAY frame with 0 as error) - Streams in a connection would be aborted prematurely when a GOAWAY frame with a lastStreamId of 2^31-1 was received. Fixes: QTBUG-73947 Change-Id: Iddee9385c1db3cc4bb80e07efac7220fff787bf3 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix a crash in QHttp2ProtocolHandler in h2c-direct modeAlexey Edelev2019-03-291-1/+1
| | | | | | | | | | | | | | | | After 'h2c' mode was implemented with the proper protocol upgrade, the previously working 'direct connection' mode was lost for clear text connections due to the erroneous logic in the constructor: having !channel->ssl does not necessary mean we started with HTTP/1.1 request, including protocol upgrade header; it can also mean we connected a plain socket and immediately sending h2 frames, without any H2 negotiation at all. Fixes: QTBUG-74765 Change-Id: Ice466d6bffb40048b7ab46fb064f2d3d795a12aa Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* http2: skip content-length for content-encoding: gzip/deflateTimur Pocheptsov2019-02-011-0/+4
| | | | | | | | | The protocol handler now matches HTTP/1.1's protocol handler. Change-Id: Id55c10900e2bcd46e5dc65c63db77097eb4818b6 Fixes: QTBUG-73364 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QByteArray: add compare() with case sensitivity optionsThiago Macieira2018-06-221-6/+9
| | | | | | | | | | | | | Need to do the same for startsWith() and endsWith(). indexOf() is a lot harder. [ChangeLog][QtCore][QByteArray] Added compare(), which takes Qt::CaseSensitivity as one of the parameters. This function is more efficient than using toLower() or toUpper() and then comparing. Change-Id: Ib48364abee9f464c96c6fffd152e69bde4194df7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Http/2 - remove unused 'compressedData'Timur Pocheptsov2018-05-241-1/+0
| | | | | | | | and thus reduce memory consumption, allocations etc. Task-number: QTBUG-68394 Change-Id: Ibad9b01a1e709e6abafcd9531fbcfc1eafa9cff3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* HTTP/2 - reset uploadByteDevice if necessaryTimur Pocheptsov2018-04-121-0/+14
| | | | | | | | | | | | | | | | 1. If a request was redirected or some error was encountered, we try to reset the uploading byte-device. 2. Disconnecting from the byte-device is not enough, since we have a queued connection, _q_uploadDataReadyRead() gets called even if byte-device was deleted and thus sender() can return null - we have to check this condition. 3. Update auto-test with a case where our server immediately replies with a redirect status code. Task-number: QTBUG-67469 Task-number: QTBUG-66913 Change-Id: I9b364cf3dee1717940ddbe50cba37c3398cc9c95 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* HTTP/2 - treat HEADERS frames as valid for streams in 'open' stateTimur Pocheptsov2018-04-051-3/+4
| | | | | | | | | | | | | | | | Previously, I erroneously expected HEADERS frame only on a stream, which is in half-closed (local) or reserved (remote) state. But 'open' state is also valid (RFC7540, 6.2). For example, we start uploading some data, we have sent HEADERS frame and now are sending DATA frames, without END_STREAM flag set yet; this stream is in 'open' state. If a server wants to reply with some error status code or redirect - it does not have to wait for our END_STREAM flag, reading all this data that will be discarded anyway. Task-number: QTBUG-67469 Change-Id: I53e3a5e9b2ab7f7917ae083ba44e862a227db238 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-231-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qhttp2protocolhandler_p.h src/network/kernel/kernel.pri src/network/ssl/qsslkey_qt.cpp src/plugins/platforms/cocoa/qcocoascreen.mm src/plugins/platforms/windows/accessible/iaccessible2.cpp src/plugins/platforms/windows/accessible/iaccessible2.h src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h src/widgets/widgets/qmenu_p.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/other/qaccessibility/tst_qaccessibility.cpp tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-11-171-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also blacklist tst_QNetworkReply::ioHttpRedirectErrors(too-many-redirects) on RHEL 6.6 in CI. Conflicts: tests/auto/network/access/qnetworkreply/BLACKLIST tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Task-number: QTBUG-64569 Change-Id: I7514fc0660c18fd3a3e1d0d0af3f15d879e3c6f4
| | * HTTP/2 - fix header processingTimur Pocheptsov2017-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | httpReply->setHeaderField does not simply append (name|value) pairs, it first erases all entries with the same name. This is quite wrong when we have _several_ 'Set-Cookie' headers, for example. Found while trying to login into a facebook account :) Task-number: QTBUG-64359 Change-Id: I51416ca3ba3d92b9414e4649e493d9cd88f6d9a0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Merge "Merge remote-tracking branch 'origin/5.10' into dev" into ↵Liang Qi2017-11-061-18/+47
|\ \ \ | | | | | | | | | | | | refs/staging/dev
| * | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-051-18/+47
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/minimum-linux.S src/network/access/qhttpthreaddelegate.cpp src/widgets/kernel/qwidgetwindow.cpp Change-Id: Id2e817e85f85c68f5482c9a12912d35590f9d5f8
| | * | HTTP/2 - make protocol settings configurablev5.10.0-beta3Timur Pocheptsov2017-10-261-18/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Recently we have updated our receive window size to a larger value. Unfortunately, this also results in auto-test pumping through more data, which probably takes more time on CI. At the moment we do not have any public API on QNAM's level to customize HTTP/2 parameters (aka 5.10/FF and so on). So we use the fact that QNAM is QObject and we can set a property on it. This property is our Http2::ProtocolParameters object that allows us to configure: - HPACK parameters (in 5.10 - noop) - session receive window size - different SETTINGS as described by RFC 7540, 6.5.2. 2. Undocumented environment variable to set ENABLE_PUSH is not needed anymore. 3. In 5.11 Http2::ProtocolParameter will become a public API and we'll introduce a new setter in QNAM. Change-Id: If08fd5e09e7c0b61cf9700b426b60b5837b6b2e6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | | Modernize use of 'http' featureUlf Hermann2017-11-061-4/+0
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | Exclude QHttp(Multi)Part from being built if http is disabled, and replace the exclusion macros. Use the qmake project files to exclude source files, and QT_REQUIRE_CONFIG(http) in headers. Change-Id: I432fa3c78aa97b5ed2eb1027ac1dc3bdb134f9ba Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* / / QHttp2ProtocolHandler - avoid calls to detach in a range-loopTimur Pocheptsov2017-10-241-1/+2
|/ / | | | | | | | | | | | | | | Found by clazy-range-loop check. Change-Id: I45fd03af60c8d15e1288cc8abd81d8532b9a6c45 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | HTTP/2 protocol handler: tweak receive window sizesTimur Pocheptsov2017-10-161-17/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were using the default ones, provided by RFC7540. It appears they are way too restrictive and conservative: when downloading something relatively big, a stream keeps spending the whole session/its own 'recv' windows and thus we have to constantly send WINDOW_UPDATE frames. This significantly slows down our HTTP/2 implementation, making it orders of magnitude slower than HTTP/1.1. To fix this: - We send SETTINGS_INITIAL_WINDOW_SIZE in the first SETTINGS frame to inform our peer that per-stream WINDOW is bigger than 64Kb - We increase the session's receive window size. Task-number: QTBUG-63722 Change-Id: I31312fcfd5f0fc0aee6aaa5d3562cc7d1b931adc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-041-1/+20
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qconfig-bootstrapped.h src/corelib/global/qglobal.h src/corelib/tools/qcryptographichash.cpp src/corelib/tools/qcryptographichash.h src/corelib/tools/qmessageauthenticationcode.cpp src/plugins/platforms/windows/qwindowswindow.h tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST Change-Id: Ib68112de985a3d714c2071f47c10e907e4f0229a
| * HTTP/2 protocol handler: set redirect URL on replyTimur Pocheptsov2017-09-291-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For HTTP/1 it's done when no data expected and response headers received - protocol handler emits channel->allDone which handles the status code and sets (if needed) a redirectUrl. HTTP/2 protocol handler cannot emit allDone (it has many requests multiplexed and actually cannot say allDone yet). So we set a redirect url if we have the corresponding status code and found 'location' header. Task-number: QTBUG-63471 Change-Id: Ibd3438ef918c245a46b8c0128910a89b9a418448 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Revert "HTTP/2 protocol handler: set the redirect URL on reply"Timur Pocheptsov2017-09-291-18/+1
| | | | | | | | | | | | | | | | | | | | This reverts commit 9e268185bbb39285ee087868f9d904d7c9f6fe61. Reasons: must go into 5.9 + the logic in this patch needs fixing, not good as it is now. Change-Id: I92516ddb1d2661d85ce77c54a1307f45df1ab635 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | HTTP/2 protocol handler: set the redirect URL on replyTimur Pocheptsov2017-09-281-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | For HTTP/1 it's done when no data expected and response headers received - protocol handler emits channel->allDone which handles the status code and sets (if needed) a redirectUrl. HTTP/2 protocol handler cannot emit allDone (it has many requests multiplexed and actually cannot say allDone yet). So we set a redirect url if we have the corresponding status code and found 'location' header. Before it's too late. Task-number: QTBUG-63471 Change-Id: Icfa871fb999e676650d62c45a20e689596da4028 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | HTTP/2 - implement the proper 'h2c' (protocol upgrade)Timur Pocheptsov2017-08-271-14/+24
|/ | | | | | | | | | | | | | | | | | | | | | | | | Without TLS (and thus ALPN/NPN negotiation) HTTP/2 requires a protocol upgrade procedure, as described in RFC 7540, 3.2. We start as HTTP/1.1 (and thus we create QHttpProtocolHandler first), augmenting the headers we send with 'Upgrade: h2c'. In case we receive HTTP/1.1 response with status code 101 ('Switching Protocols'), we continue as HTTP/2 session, creating QHttp2ProtocolHandler and pretending the first request we sent was HTTP/2 request on a real HTTP/2 stream. If the first response is something different from 101, we continue as HTTP/1.1. This change also required auto-test update: our toy-server now has to respond to the initial HTTP/1.1 request on a platform without ALPN/NPN. As a bonus a subtle flakyness in 'goaway' auto-test went away (well, it was fixed). [ChangeLog][QtNetwork][HTTP/2] In case of clear text HTTP/2 we now initiate a required protocol upgrade procedure instead of 'H2Direct' connection. Task-number: QTBUG-61397 Change-Id: I573fa304fdaf661490159037dc47775d97c8ea5b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Use QNetworkReply::ProtocolFailure in HTTP/2 failuresThiago Macieira2017-05-081-4/+4
| | | | | | | | | ProtocolInvalidOperationError are meant for actual replies from the server indicating that the operation is not valid (HTTP 400 Bad Request). Change-Id: I9ad33fff8b634979bdbafffd14bbc57e4b21d6bf Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Use HTTP2WasUsedAttribute for HTTP2Timur Pocheptsov2017-03-291-0/+2
| | | | | | | | | | | Previously we were always setting SpdyWasUsedAttribute for SPDY/HTTP/2/HTTP/1.1 (true/false) which is confusing. Now if HTTP2AllowedAttribute was set to true on a request, we set HTTP2WasUsedAttribute. Otherwise, as we did before, we're setting SpdyWasUsedAttribute. Change-Id: I0c44cfb5469fef0c12719baa951197ee2accee4a Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* HTTP/2 - fix SETTINGS frame validationTimur Pocheptsov2017-01-171-1/+1
| | | | | | | | | When testing peer's SETTINGS frames, namely MAX_CONCURRENT_STREAM identifier, we should test against upper limit _new_ values from these frames, not our own pre-set maxConcurrentStreams (it apparently was a typo). Change-Id: I2036e45b0f931914f75ca99142192e2f9385623e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* qhttp2protocolhandler - handle proxies correctlyTimur Pocheptsov2017-01-111-3/+12
| | | | | | | | For requests through proxy, the Request-URI (':path' header) must contain full url. Change-Id: Ibecdf4556b0cecf731da0f89b241bb86a07fa3ad Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* HTTP/2 - fix handling of GOAWAY frameTimur Pocheptsov2017-01-111-9/+18
| | | | | | | | | | | | | | | | | | | - Fix the case when we erroneously handled stream ID == 0 in a GOAWAY frame as an invalid stream ID. - _q_receivedReply: convert do{}while() loop into to while(){} to prevent it from handling any frames after GOAWAY frame received and all active frame finished. - sendRequest - if we received GOAWAY, also clear spdyRequests in the connection channel, otherwise it keeps re-trying to send requests! - Http network connection channel never resets a protocolHandler in _q_encrypted/ _q_connected, which is BAD for HTTP/2, since HTTP/2 has unique per-connection compression context and must be reset - now we recreate the protocol handler in _q_encrypted or _q_connected (https/http). - Update autotest. Task-number: QTBUG-57600 Change-Id: Ib864ce52287bab23334ff43a83ba4b0b7cb52c60 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* HTTP/2 - fix the handling of PUSH_PROMISETimur Pocheptsov2016-10-211-75/+297
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | HTTP/2 allows a server to pre-emptively send (or "push") responses (along with corresponding "promised" requests) to a client in association with a previous client-initiated request. This can be useful when the server knows the client will need to have those responses available in order to fully process the response to the original request. Server push is semantically equivalent to a server responding to a request; however, in this case, that request is also sent by the server, as a PUSH_PROMISE frame. The PUSH_PROMISE frame includes a header block that contains a complete set of request header fields that the server attributes to the request. After sending the PUSH_PROMISE frame, the server can begin delivering the pushed response as a response on a server-initiated stream that uses the promised stream identifier. This patch: - fixes the HPACK decompression of PUSH_PROMISE frames; - allows a user to enable PUSH_PROMISE; - processes and caches pushed data for promised streams; - updates auto-test - emulates a simple PUSH_PROMISE scenario. Change-Id: Ic4850863a5e3895320baac3871a723fc091b4aca Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Refactor Http2::FrameReader/Http2::FrameWriterTimur Pocheptsov2016-08-191-78/+83
| | | | | | | | | | | | | | Introduce new entity: class Http2::Frame with accessors like payloadSize/type/flags/streamID etc. (they actually read /interpret raw bytes from a frame's buffer) instead of duplicating this functionality in reader/writer classes. Delete defaulted members and remove explicitly defined move ctors/operators (not needed actually). Update auto-test ('HTTP/2 server') to use these new classes. Change-Id: Ie3516efbd095704e212142eef9e792323678ccfa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* HTTP/2 - do not set END_HEADERS if we have CONTINUATIONsTimur Pocheptsov2016-08-171-1/+1
| | | | | | | | | Setting END_HEADERS flag on a HEADERS frame means we do not have CONTINUATION frame(s). So do NOT set it too early, only if we fit into a single frame. Change-Id: I891a2db227cee59e4eacfe7c2f18b431cd85fe47 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Enable cleartext HTTP/2 and bring the auto-test back to lifeTimur Pocheptsov2016-08-111-2/+2
| | | | | | | | | | | | | | HTTP/2 does not require TLS connection, it can work in a cleartext mode. Plus at the moment only OpenSSL backend allows HTTP/2 negotiation via ALPN/NPN (and none of our CI configurations with OpenSSL supports these extensions, rendering HTTP/2 auto-test useless). This patch implements cleartext HTTP/2 ('h2c') in 'direct' mode - this is allowed if a client has a prior knowledge that HTTP/2 is supported by a server. Change-Id: I4978775e9732c40bc77f549b83bb4a5d1761887e Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* http2frame - do not rely on a socket's bufferTimur Pocheptsov2016-08-111-55/+51
| | | | | | | | | | | | | | | - Whenever we have a read notification, read this data, even if it's not enough for a frame's header - otherwise, QNAM can use a socket in an Ubuffered mode and FrameReader can potentially fail to read anything correctly. - Do not call/rely on bytesAvailable and do not try to invoke _q_receiveReply in Qt::QueuedConnection mode, instead try to read until we end up in an incomplete frame or some error. Change-Id: I7f44ba9e34bc64f3e26bd29080f0050da635b3ae Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Revert "Implement protocol upgrade for HTTP/2 enabled requests"Timur Pocheptsov2016-08-041-36/+15
| | | | | | | | | This reverts commit 12d71f4ea20415ff2274e1e90f9e4d5a8b935d7f. This change is breaking a build + incomplete as my test revealed. Will have to re-try later. Change-Id: I7ea089093a832aa5822caaaac56e62f5fda4df17 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Implement protocol upgrade for HTTP/2 enabled requestsTimur Pocheptsov2016-08-031-15/+36
| | | | | | | | | | | | | | Without ALPN/NPN (== without OpenSSL) we can negotiate HTTP/2 using the protocol upgrade procedure as described by RFC7540. Since there is no TLS handshake, after our http channel was connected we first send an 'augmented' HTTP/1.1 request - its header contains additional 'HTTP2-Settings' and 'Upgrade' (to 'h2c') fields. If we receive reponse 101 (switch protocol) we re-create a protocol handler and switch to HTTP/2. Task-number: QTBUG-50955 Change-Id: I36e9985e06ba76edaf7fdb22bb43770f8d593c61 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* fix namespaced buildOswald Buddenhagen2016-08-011-2/+2
| | | | | Change-Id: I37b571db193d444ea60d508375fef89add467d1e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* Remove SSL includes from qhttpnetworkconnection_p.hFriedemann Kleint2016-07-121-2/+0
| | | | | | | | | | | | | | | | | On Windows, qsslcontext_openssl_p.h pulls in an unsanitized windows.h, causing the infamous min/max macros to be defined, requiring a #define NOMINMAX in qhttp2protocolhandler.cpp. This in turn breaks the MinGW developer build since that has NOMINMAX globally defined: access\qhttp2protocolhandler.cpp:40:0: error: "NOMINMAX" redefined [-Werror] Remove the include, adding missing forward declarations and include directives to the source files. Change-Id: Ic1c2c711d87599b15ad6e2d87eae7153a44ace47 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* HTTP2 protocol handlerTimur Pocheptsov2016-07-081-0/+1219
Add HTTP2 support in QNAM - QHttp2ProtocolHandler + aux. classes. [ChangeLog][QtNetwork] Added support for HTTP/2 protocol Task-number: QTBUG-50956 Change-Id: I3a119cfbb1fb3118d9003225f5e54b46ae2829b6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>