diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-28 13:13:16 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-28 13:14:15 +0100 |
commit | 846cc4c75cc06def67e831c8cb3c9edaef24f8f0 (patch) | |
tree | cf8cd76a5a610a6264583148b2c0549f7514dde3 /src/network/access/qhttpnetworkreply.cpp | |
parent | 9e4a215a2569a04010292c8718d0f0569bc06c12 (diff) | |
parent | 0d0fb04d505d105fb4b2fc71d68f729ce670b12e (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/network/access/qhttpthreaddelegate.cpp
Change-Id: Ia15372687c93cd585967b006c0baaac3a5f29e91
Diffstat (limited to 'src/network/access/qhttpnetworkreply.cpp')
-rw-r--r-- | src/network/access/qhttpnetworkreply.cpp | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 1b9e1f5a53..2a7e6ed638 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -265,6 +265,16 @@ bool QHttpNetworkReply::isPipeliningUsed() const return d_func()->pipeliningUsed; } +bool QHttpNetworkReply::isSpdyUsed() const +{ + return d_func()->spdyUsed; +} + +void QHttpNetworkReply::setSpdyWasUsed(bool spdy) +{ + d_func()->spdyUsed = spdy; +} + QHttpNetworkConnection* QHttpNetworkReply::connection() { return d_func()->connection; @@ -281,9 +291,15 @@ QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl) connectionCloseEnabled(true), forceConnectionCloseEnabled(false), lastChunkRead(false), - currentChunkSize(0), currentChunkRead(0), readBufferMaxSize(0), connection(0), + currentChunkSize(0), currentChunkRead(0), readBufferMaxSize(0), + windowSizeDownload(65536), // 64K initial window size according to SPDY standard + windowSizeUpload(65536), // 64K initial window size according to SPDY standard + currentlyReceivedDataInWindow(0), + currentlyUploadedDataInWindow(0), + totallyUploadedData(0), + connection(0), autoDecompress(false), responseData(), requestIsPrepared(false) - ,pipeliningUsed(false), downstreamLimited(false) + ,pipeliningUsed(false), spdyUsed(false), downstreamLimited(false) ,userProvidedDownloadBuffer(0) #ifndef QT_NO_COMPRESS ,inflateStrm(0) @@ -550,15 +566,7 @@ qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) // allocate inflate state if (!inflateStrm) inflateStrm = new z_stream; - inflateStrm->zalloc = Z_NULL; - inflateStrm->zfree = Z_NULL; - inflateStrm->opaque = Z_NULL; - inflateStrm->avail_in = 0; - inflateStrm->next_in = Z_NULL; - // "windowBits can also be greater than 15 for optional gzip decoding. - // Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection" - // http://www.zlib.net/manual.html - int ret = inflateInit2(inflateStrm, MAX_WBITS+32); + int ret = initializeInflateStream(); if (ret != Z_OK) return -1; } @@ -703,8 +711,28 @@ qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QByteDataBuff } #ifndef QT_NO_COMPRESS +int QHttpNetworkReplyPrivate::initializeInflateStream() +{ + inflateStrm->zalloc = Z_NULL; + inflateStrm->zfree = Z_NULL; + inflateStrm->opaque = Z_NULL; + inflateStrm->avail_in = 0; + inflateStrm->next_in = Z_NULL; + // "windowBits can also be greater than 15 for optional gzip decoding. + // Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection" + // http://www.zlib.net/manual.html + int ret = inflateInit2(inflateStrm, MAX_WBITS+32); + Q_ASSERT(ret == Z_OK); + return ret; +} + qint64 QHttpNetworkReplyPrivate::uncompressBodyData(QByteDataBuffer *in, QByteDataBuffer *out) { + if (!inflateStrm) { // happens when called from the SPDY protocol handler + inflateStrm = new z_stream; + initializeInflateStream(); + } + if (!inflateStrm) return -1; |