author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 12:15:23 +0300 | |
branch | RCL_3 |
changeset 12 | cc75c76972ee |
parent 7 | 3f74d0d4af4c |
child 13 | c0432d11811c |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtNetwork module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include "qhttpnetworkconnection_p.h" |
|
43 |
#include "qhttpnetworkconnectionchannel_p.h" |
|
44 |
#include "private/qnoncontiguousbytedevice_p.h" |
|
45 |
||
46 |
#include <qpair.h> |
|
47 |
#include <qdebug.h> |
|
48 |
||
49 |
#ifndef QT_NO_HTTP |
|
50 |
||
51 |
#ifndef QT_NO_OPENSSL |
|
52 |
# include <QtNetwork/qsslkey.h> |
|
53 |
# include <QtNetwork/qsslcipher.h> |
|
54 |
# include <QtNetwork/qsslconfiguration.h> |
|
55 |
#endif |
|
56 |
||
57 |
QT_BEGIN_NAMESPACE |
|
58 |
||
59 |
// TODO: Put channel specific stuff here so it does not polute qhttpnetworkconnection.cpp |
|
60 |
||
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
61 |
QHttpNetworkConnectionChannel::QHttpNetworkConnectionChannel() |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
62 |
: socket(0) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
63 |
, state(IdleState) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
64 |
, reply(0) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
65 |
, written(0) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
66 |
, bytesTotal(0) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
67 |
, resendCurrent(false) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
68 |
, lastStatus(0) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
69 |
, pendingEncrypt(false) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
70 |
, reconnectAttempts(2) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
71 |
, authMehtod(QAuthenticatorPrivate::None) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
72 |
, proxyAuthMehtod(QAuthenticatorPrivate::None) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
73 |
#ifndef QT_NO_OPENSSL |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
74 |
, ignoreAllSslErrors(false) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
75 |
#endif |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
76 |
, pipeliningSupported(PipeliningSupportUnknown) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
77 |
, connection(0) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
78 |
{ |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
79 |
// Inlining this function in the header leads to compiler error on |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
80 |
// release-armv5, on at least timebox 9.2 and 10.1. |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
81 |
} |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
82 |
|
0 | 83 |
void QHttpNetworkConnectionChannel::init() |
84 |
{ |
|
85 |
#ifndef QT_NO_OPENSSL |
|
86 |
if (connection->d_func()->encrypt) |
|
87 |
socket = new QSslSocket; |
|
88 |
else |
|
89 |
socket = new QTcpSocket; |
|
90 |
#else |
|
91 |
socket = new QTcpSocket; |
|
92 |
#endif |
|
93 |
||
94 |
// limit the socket read buffer size. we will read everything into |
|
95 |
// the QHttpNetworkReply anyway, so let's grow only that and not |
|
96 |
// here and there. |
|
97 |
socket->setReadBufferSize(64*1024); |
|
98 |
||
99 |
QObject::connect(socket, SIGNAL(bytesWritten(qint64)), |
|
100 |
this, SLOT(_q_bytesWritten(qint64)), |
|
101 |
Qt::DirectConnection); |
|
102 |
QObject::connect(socket, SIGNAL(connected()), |
|
103 |
this, SLOT(_q_connected()), |
|
104 |
Qt::DirectConnection); |
|
105 |
QObject::connect(socket, SIGNAL(readyRead()), |
|
106 |
this, SLOT(_q_readyRead()), |
|
107 |
Qt::DirectConnection); |
|
108 |
QObject::connect(socket, SIGNAL(disconnected()), |
|
109 |
this, SLOT(_q_disconnected()), |
|
110 |
Qt::DirectConnection); |
|
111 |
QObject::connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), |
|
112 |
this, SLOT(_q_error(QAbstractSocket::SocketError)), |
|
113 |
Qt::DirectConnection); |
|
114 |
#ifndef QT_NO_NETWORKPROXY |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
115 |
QObject::connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
116 |
this, SLOT(_q_proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), |
0 | 117 |
Qt::DirectConnection); |
118 |
#endif |
|
119 |
||
120 |
#ifndef QT_NO_OPENSSL |
|
121 |
QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket); |
|
122 |
if (sslSocket) { |
|
123 |
// won't be a sslSocket if encrypt is false |
|
124 |
QObject::connect(sslSocket, SIGNAL(encrypted()), |
|
125 |
this, SLOT(_q_encrypted()), |
|
126 |
Qt::DirectConnection); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
127 |
QObject::connect(sslSocket, SIGNAL(sslErrors(QList<QSslError>)), |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
128 |
this, SLOT(_q_sslErrors(QList<QSslError>)), |
0 | 129 |
Qt::DirectConnection); |
130 |
QObject::connect(sslSocket, SIGNAL(encryptedBytesWritten(qint64)), |
|
131 |
this, SLOT(_q_encryptedBytesWritten(qint64)), |
|
132 |
Qt::DirectConnection); |
|
133 |
} |
|
134 |
#endif |
|
135 |
} |
|
136 |
||
137 |
||
138 |
void QHttpNetworkConnectionChannel::close() |
|
139 |
{ |
|
140 |
socket->blockSignals(true); |
|
141 |
socket->close(); |
|
142 |
socket->blockSignals(false); |
|
143 |
state = QHttpNetworkConnectionChannel::IdleState; |
|
144 |
} |
|
145 |
||
146 |
||
147 |
bool QHttpNetworkConnectionChannel::sendRequest() |
|
148 |
{ |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
149 |
if (!reply) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
150 |
// heh, how should that happen! |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
151 |
qWarning() << "QHttpNetworkConnectionChannel::sendRequest() called without QHttpNetworkReply"; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
152 |
state = QHttpNetworkConnectionChannel::IdleState; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
153 |
return false; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
154 |
} |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
155 |
|
0 | 156 |
switch (state) { |
157 |
case QHttpNetworkConnectionChannel::IdleState: { // write the header |
|
158 |
if (!ensureConnection()) { |
|
159 |
// wait for the connection (and encryption) to be done |
|
160 |
// sendRequest will be called again from either |
|
161 |
// _q_connected or _q_encrypted |
|
162 |
return false; |
|
163 |
} |
|
164 |
written = 0; // excluding the header |
|
165 |
bytesTotal = 0; |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
166 |
|
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
167 |
reply->d_func()->clear(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
168 |
reply->d_func()->connection = connection; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
169 |
reply->d_func()->connectionChannel = this; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
170 |
reply->d_func()->autoDecompress = request.d->autoDecompress; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
171 |
reply->d_func()->pipeliningUsed = false; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
172 |
|
0 | 173 |
pendingEncrypt = false; |
174 |
// if the url contains authentication parameters, use the new ones |
|
175 |
// both channels will use the new authentication parameters |
|
176 |
if (!request.url().userInfo().isEmpty()) { |
|
177 |
QUrl url = request.url(); |
|
178 |
QAuthenticator &auth = authenticator; |
|
179 |
if (url.userName() != auth.user() |
|
180 |
|| (!url.password().isEmpty() && url.password() != auth.password())) { |
|
181 |
auth.setUser(url.userName()); |
|
182 |
auth.setPassword(url.password()); |
|
183 |
connection->d_func()->copyCredentials(connection->d_func()->indexOf(socket), &auth, false); |
|
184 |
} |
|
185 |
// clear the userinfo, since we use the same request for resending |
|
186 |
// userinfo in url can conflict with the one in the authenticator |
|
187 |
url.setUserInfo(QString()); |
|
188 |
request.setUrl(url); |
|
189 |
} |
|
190 |
connection->d_func()->createAuthorization(socket, request); |
|
191 |
#ifndef QT_NO_NETWORKPROXY |
|
192 |
QByteArray header = QHttpNetworkRequestPrivate::header(request, |
|
193 |
(connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy)); |
|
194 |
#else |
|
195 |
QByteArray header = QHttpNetworkRequestPrivate::header(request, false); |
|
196 |
#endif |
|
197 |
socket->write(header); |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
198 |
// flushing is dangerous (QSslSocket calls transmit which might read or error) |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
199 |
// socket->flush(); |
0 | 200 |
QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); |
201 |
if (uploadByteDevice) { |
|
202 |
// connect the signals so this function gets called again |
|
203 |
QObject::connect(uploadByteDevice, SIGNAL(readyRead()),this, SLOT(_q_uploadDataReadyRead())); |
|
204 |
||
205 |
bytesTotal = request.contentLength(); |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
206 |
|
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
207 |
state = QHttpNetworkConnectionChannel::WritingState; // start writing data |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
208 |
sendRequest(); //recurse |
0 | 209 |
} else { |
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
210 |
state = QHttpNetworkConnectionChannel::WaitingState; // now wait for response |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
211 |
sendRequest(); //recurse |
0 | 212 |
} |
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
213 |
|
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
214 |
break; |
0 | 215 |
} |
216 |
case QHttpNetworkConnectionChannel::WritingState: |
|
217 |
{ |
|
218 |
// write the data |
|
219 |
QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); |
|
220 |
if (!uploadByteDevice || bytesTotal == written) { |
|
221 |
if (uploadByteDevice) |
|
222 |
emit reply->dataSendProgress(written, bytesTotal); |
|
223 |
state = QHttpNetworkConnectionChannel::WaitingState; // now wait for response |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
224 |
sendRequest(); // recurse |
0 | 225 |
break; |
226 |
} |
|
227 |
||
228 |
// only feed the QTcpSocket buffer when there is less than 32 kB in it |
|
229 |
const qint64 socketBufferFill = 32*1024; |
|
230 |
const qint64 socketWriteMaxSize = 16*1024; |
|
231 |
||
232 |
||
233 |
#ifndef QT_NO_OPENSSL |
|
234 |
QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket); |
|
235 |
// if it is really an ssl socket, check more than just bytesToWrite() |
|
236 |
while ((socket->bytesToWrite() + (sslSocket ? sslSocket->encryptedBytesToWrite() : 0)) |
|
237 |
<= socketBufferFill && bytesTotal != written) |
|
238 |
#else |
|
239 |
while (socket->bytesToWrite() <= socketBufferFill |
|
240 |
&& bytesTotal != written) |
|
241 |
#endif |
|
242 |
{ |
|
243 |
// get pointer to upload data |
|
244 |
qint64 currentReadSize; |
|
245 |
qint64 desiredReadSize = qMin(socketWriteMaxSize, bytesTotal - written); |
|
246 |
const char *readPointer = uploadByteDevice->readPointer(desiredReadSize, currentReadSize); |
|
247 |
||
248 |
if (currentReadSize == -1) { |
|
249 |
// premature eof happened |
|
250 |
connection->d_func()->emitReplyError(socket, reply, QNetworkReply::UnknownNetworkError); |
|
251 |
return false; |
|
252 |
break; |
|
253 |
} else if (readPointer == 0 || currentReadSize == 0) { |
|
254 |
// nothing to read currently, break the loop |
|
255 |
break; |
|
256 |
} else { |
|
257 |
qint64 currentWriteSize = socket->write(readPointer, currentReadSize); |
|
258 |
if (currentWriteSize == -1 || currentWriteSize != currentReadSize) { |
|
259 |
// socket broke down |
|
260 |
connection->d_func()->emitReplyError(socket, reply, QNetworkReply::UnknownNetworkError); |
|
261 |
return false; |
|
262 |
} else { |
|
263 |
written += currentWriteSize; |
|
264 |
uploadByteDevice->advanceReadPointer(currentWriteSize); |
|
265 |
||
266 |
emit reply->dataSendProgress(written, bytesTotal); |
|
267 |
||
268 |
if (written == bytesTotal) { |
|
269 |
// make sure this function is called once again |
|
270 |
state = QHttpNetworkConnectionChannel::WaitingState; |
|
271 |
sendRequest(); |
|
272 |
break; |
|
273 |
} |
|
274 |
} |
|
275 |
} |
|
276 |
} |
|
277 |
break; |
|
278 |
} |
|
279 |
||
280 |
case QHttpNetworkConnectionChannel::WaitingState: |
|
281 |
{ |
|
282 |
QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); |
|
283 |
if (uploadByteDevice) { |
|
284 |
QObject::disconnect(uploadByteDevice, SIGNAL(readyRead()), this, SLOT(_q_uploadDataReadyRead())); |
|
285 |
} |
|
286 |
||
287 |
// HTTP pipelining |
|
288 |
connection->d_func()->fillPipeline(socket); |
|
289 |
socket->flush(); |
|
290 |
||
291 |
// ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called |
|
292 |
// this is needed if the sends an reply before we have finished sending the request. In that |
|
293 |
// case receiveReply had been called before but ignored the server reply |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
294 |
QMetaObject::invokeMethod(this, "_q_receiveReply", Qt::QueuedConnection); |
0 | 295 |
break; |
296 |
} |
|
297 |
case QHttpNetworkConnectionChannel::ReadingState: |
|
298 |
case QHttpNetworkConnectionChannel::Wait4AuthState: |
|
299 |
// ignore _q_bytesWritten in these states |
|
300 |
// fall through |
|
301 |
default: |
|
302 |
break; |
|
303 |
} |
|
304 |
return true; |
|
305 |
} |
|
306 |
||
307 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
308 |
void QHttpNetworkConnectionChannel::_q_receiveReply() |
0 | 309 |
{ |
310 |
Q_ASSERT(socket); |
|
311 |
||
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
312 |
if (!reply) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
313 |
// heh, how should that happen! |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
314 |
qWarning() << "QHttpNetworkConnectionChannel::_q_receiveReply() called without QHttpNetworkReply," |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
315 |
<< socket->bytesAvailable() << "bytes on socket."; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
316 |
close(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
317 |
return; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
318 |
} |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
319 |
|
0 | 320 |
qint64 bytes = 0; |
321 |
QAbstractSocket::SocketState socketState = socket->state(); |
|
322 |
||
323 |
// connection might be closed to signal the end of data |
|
324 |
if (socketState == QAbstractSocket::UnconnectedState) { |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
325 |
if (socket->bytesAvailable() <= 0) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
326 |
if (reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
327 |
// finish this reply. this case happens when the server did not send a content length |
0 | 328 |
reply->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState; |
329 |
allDone(); |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
330 |
return; |
0 | 331 |
} else { |
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
332 |
handleUnexpectedEOF(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
333 |
return; |
0 | 334 |
} |
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
335 |
} else { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
336 |
// socket not connected but still bytes for reading.. just continue in this function |
0 | 337 |
} |
338 |
} |
|
339 |
||
340 |
// read loop for the response |
|
341 |
while (socket->bytesAvailable()) { |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
342 |
QHttpNetworkReplyPrivate::ReplyState state = reply->d_func()->state; |
0 | 343 |
switch (state) { |
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
344 |
case QHttpNetworkReplyPrivate::NothingDoneState: { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
345 |
// only eat whitespace on the first call |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
346 |
eatWhitespace(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
347 |
state = reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
348 |
// fallthrough |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
349 |
} |
0 | 350 |
case QHttpNetworkReplyPrivate::ReadingStatusState: { |
351 |
qint64 statusBytes = reply->d_func()->readStatus(socket); |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
352 |
if (statusBytes == -1) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
353 |
// connection broke while reading status. also handled if later _q_disconnected is called |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
354 |
handleUnexpectedEOF(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
355 |
return; |
0 | 356 |
} |
357 |
bytes += statusBytes; |
|
358 |
lastStatus = reply->d_func()->statusCode; |
|
359 |
break; |
|
360 |
} |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
361 |
case QHttpNetworkReplyPrivate::ReadingHeaderState: { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
362 |
QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); |
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
363 |
qint64 headerBytes = replyPrivate->readHeader(socket); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
364 |
if (headerBytes == -1) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
365 |
// connection broke while reading headers. also handled if later _q_disconnected is called |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
366 |
handleUnexpectedEOF(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
367 |
return; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
368 |
} |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
369 |
bytes += headerBytes; |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
370 |
if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState) { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
371 |
if (replyPrivate->isGzipped() && replyPrivate->autoDecompress) { |
0 | 372 |
// remove the Content-Length from header |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
373 |
replyPrivate->removeAutoDecompressHeader(); |
0 | 374 |
} else { |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
375 |
replyPrivate->autoDecompress = false; |
0 | 376 |
} |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
377 |
if (replyPrivate->statusCode == 100) { |
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
378 |
replyPrivate->clearHttpLayerInformation(); |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
379 |
replyPrivate->state = QHttpNetworkReplyPrivate::ReadingStatusState; |
0 | 380 |
break; // ignore |
381 |
} |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
382 |
if (replyPrivate->shouldEmitSignals()) |
0 | 383 |
emit reply->headerChanged(); |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
384 |
if (!replyPrivate->expectContent()) { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
385 |
replyPrivate->state = QHttpNetworkReplyPrivate::AllDoneState; |
0 | 386 |
allDone(); |
387 |
return; |
|
388 |
} |
|
389 |
} |
|
390 |
break; |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
391 |
} |
0 | 392 |
case QHttpNetworkReplyPrivate::ReadingDataState: { |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
393 |
QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
394 |
if (replyPrivate->downstreamLimited && !replyPrivate->responseData.isEmpty() && replyPrivate->shouldEmitSignals()) { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
395 |
// We already have some HTTP body data. We don't read more from the socket until |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
396 |
// this is fetched by QHttpNetworkAccessHttpBackend. If we would read more, |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
397 |
// we could not limit our read buffer usage. |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
398 |
// We only do this when shouldEmitSignals==true because our HTTP parsing |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
399 |
// always needs to parse the 401/407 replies. Therefore they don't really obey |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
400 |
// to the read buffer maximum size, but we don't care since they should be small. |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
401 |
return; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
402 |
} |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
403 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
404 |
if (!replyPrivate->isChunked() && !replyPrivate->autoDecompress |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
405 |
&& replyPrivate->bodyLength > 0) { |
0 | 406 |
// bulk files like images should fulfill these properties and |
407 |
// we can therefore save on memory copying |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
408 |
bytes = replyPrivate->readBodyFast(socket, &replyPrivate->responseData); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
409 |
replyPrivate->totalProgress += bytes; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
410 |
if (replyPrivate->shouldEmitSignals()) { |
0 | 411 |
QPointer<QHttpNetworkReply> replyPointer = reply; |
412 |
emit reply->readyRead(); |
|
413 |
// make sure that the reply is valid |
|
414 |
if (replyPointer.isNull()) |
|
415 |
return; |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
416 |
emit reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); |
0 | 417 |
// make sure that the reply is valid |
418 |
if (replyPointer.isNull()) |
|
419 |
return; |
|
420 |
} |
|
421 |
} |
|
422 |
else |
|
423 |
{ |
|
424 |
// use the traditional slower reading (for compressed encoding, chunked encoding, |
|
425 |
// no content-length etc) |
|
426 |
QByteDataBuffer byteDatas; |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
427 |
bytes = replyPrivate->readBody(socket, &byteDatas); |
0 | 428 |
if (bytes) { |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
429 |
if (replyPrivate->autoDecompress) |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
430 |
replyPrivate->appendCompressedReplyData(byteDatas); |
0 | 431 |
else |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
432 |
replyPrivate->appendUncompressedReplyData(byteDatas); |
0 | 433 |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
434 |
if (!replyPrivate->autoDecompress) { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
435 |
replyPrivate->totalProgress += bytes; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
436 |
if (replyPrivate->shouldEmitSignals()) { |
0 | 437 |
QPointer<QHttpNetworkReply> replyPointer = reply; |
438 |
// important: At the point of this readyRead(), the byteDatas list must be empty, |
|
439 |
// else implicit sharing will trigger memcpy when the user is reading data! |
|
440 |
emit reply->readyRead(); |
|
441 |
// make sure that the reply is valid |
|
442 |
if (replyPointer.isNull()) |
|
443 |
return; |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
444 |
emit reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); |
0 | 445 |
// make sure that the reply is valid |
446 |
if (replyPointer.isNull()) |
|
447 |
return; |
|
448 |
} |
|
449 |
} |
|
450 |
#ifndef QT_NO_COMPRESS |
|
451 |
else if (!expand(false)) { // expand a chunk if possible |
|
452 |
return; // ### expand failed |
|
453 |
} |
|
454 |
#endif |
|
455 |
} |
|
456 |
} |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
457 |
// still in ReadingDataState? This function will be called again by the socket's readyRead |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
458 |
if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState) |
0 | 459 |
break; |
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
460 |
|
0 | 461 |
// everything done, fall through |
462 |
} |
|
463 |
case QHttpNetworkReplyPrivate::AllDoneState: |
|
464 |
allDone(); |
|
465 |
break; |
|
466 |
default: |
|
467 |
break; |
|
468 |
} |
|
469 |
} |
|
470 |
} |
|
471 |
||
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
472 |
// called when unexpectedly reading a -1 or when data is expected but socket is closed |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
473 |
void QHttpNetworkConnectionChannel::handleUnexpectedEOF() |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
474 |
{ |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
475 |
if (reconnectAttempts <= 0) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
476 |
// too many errors reading/receiving/parsing the status, close the socket and emit error |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
477 |
requeueCurrentlyPipelinedRequests(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
478 |
close(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
479 |
reply->d_func()->errorString = connection->d_func()->errorDetail(QNetworkReply::RemoteHostClosedError, socket); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
480 |
emit reply->finishedWithError(QNetworkReply::RemoteHostClosedError, reply->d_func()->errorString); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
481 |
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
482 |
} else { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
483 |
reconnectAttempts--; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
484 |
reply->d_func()->clear(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
485 |
reply->d_func()->connection = connection; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
486 |
reply->d_func()->connectionChannel = this; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
487 |
closeAndResendCurrentRequest(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
488 |
} |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
489 |
} |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
490 |
|
0 | 491 |
bool QHttpNetworkConnectionChannel::ensureConnection() |
492 |
{ |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
493 |
QAbstractSocket::SocketState socketState = socket->state(); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
494 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
495 |
// resend this request after we receive the disconnected signal |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
496 |
if (socketState == QAbstractSocket::ClosingState) { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
497 |
resendCurrent = true; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
498 |
return false; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
499 |
} |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
500 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
501 |
// already trying to connect? |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
502 |
if (socketState == QAbstractSocket::HostLookupState || |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
503 |
socketState == QAbstractSocket::ConnectingState) { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
504 |
return false; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
505 |
} |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
506 |
|
0 | 507 |
// make sure that this socket is in a connected state, if not initiate |
508 |
// connection to the host. |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
509 |
if (socketState != QAbstractSocket::ConnectedState) { |
0 | 510 |
// connect to the host if not already connected. |
511 |
state = QHttpNetworkConnectionChannel::ConnectingState; |
|
512 |
pendingEncrypt = connection->d_func()->encrypt; |
|
513 |
||
514 |
// reset state |
|
515 |
pipeliningSupported = PipeliningSupportUnknown; |
|
516 |
||
517 |
// This workaround is needed since we use QAuthenticator for NTLM authentication. The "phase == Done" |
|
518 |
// is the usual criteria for emitting authentication signals. The "phase" is set to "Done" when the |
|
519 |
// last header for Authorization is generated by the QAuthenticator. Basic & Digest logic does not |
|
520 |
// check the "phase" for generating the Authorization header. NTLM authentication is a two stage |
|
521 |
// process & needs the "phase". To make sure the QAuthenticator uses the current username/password |
|
522 |
// the phase is reset to Start. |
|
523 |
QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(authenticator); |
|
524 |
if (priv && priv->phase == QAuthenticatorPrivate::Done) |
|
525 |
priv->phase = QAuthenticatorPrivate::Start; |
|
526 |
priv = QAuthenticatorPrivate::getPrivate(proxyAuthenticator); |
|
527 |
if (priv && priv->phase == QAuthenticatorPrivate::Done) |
|
528 |
priv->phase = QAuthenticatorPrivate::Start; |
|
529 |
||
530 |
QString connectHost = connection->d_func()->hostName; |
|
531 |
qint16 connectPort = connection->d_func()->port; |
|
532 |
||
533 |
#ifndef QT_NO_NETWORKPROXY |
|
534 |
// HTTPS always use transparent proxy. |
|
535 |
if (connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy && !connection->d_func()->encrypt) { |
|
536 |
connectHost = connection->d_func()->networkProxy.hostName(); |
|
537 |
connectPort = connection->d_func()->networkProxy.port(); |
|
538 |
} |
|
539 |
#endif |
|
540 |
if (connection->d_func()->encrypt) { |
|
541 |
#ifndef QT_NO_OPENSSL |
|
542 |
QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket); |
|
543 |
sslSocket->connectToHostEncrypted(connectHost, connectPort); |
|
544 |
if (ignoreAllSslErrors) |
|
545 |
sslSocket->ignoreSslErrors(); |
|
546 |
sslSocket->ignoreSslErrors(ignoreSslErrorsList); |
|
547 |
#else |
|
548 |
connection->d_func()->emitReplyError(socket, reply, QNetworkReply::ProtocolUnknownError); |
|
549 |
#endif |
|
550 |
} else { |
|
551 |
socket->connectToHost(connectHost, connectPort); |
|
552 |
} |
|
553 |
return false; |
|
554 |
} |
|
555 |
return true; |
|
556 |
} |
|
557 |
||
558 |
||
559 |
#ifndef QT_NO_COMPRESS |
|
560 |
bool QHttpNetworkConnectionChannel::expand(bool dataComplete) |
|
561 |
{ |
|
562 |
Q_ASSERT(socket); |
|
563 |
Q_ASSERT(reply); |
|
564 |
||
565 |
qint64 total = reply->d_func()->compressedData.size(); |
|
566 |
if (total >= CHUNK || dataComplete) { |
|
567 |
// uncompress the data |
|
568 |
QByteArray content, inflated; |
|
569 |
content = reply->d_func()->compressedData; |
|
570 |
reply->d_func()->compressedData.clear(); |
|
571 |
||
572 |
int ret = Z_OK; |
|
573 |
if (content.size()) |
|
574 |
ret = reply->d_func()->gunzipBodyPartially(content, inflated); |
|
575 |
int retCheck = (dataComplete) ? Z_STREAM_END : Z_OK; |
|
576 |
if (ret >= retCheck) { |
|
577 |
if (inflated.size()) { |
|
578 |
reply->d_func()->totalProgress += inflated.size(); |
|
579 |
reply->d_func()->appendUncompressedReplyData(inflated); |
|
580 |
if (reply->d_func()->shouldEmitSignals()) { |
|
581 |
QPointer<QHttpNetworkReply> replyPointer = reply; |
|
582 |
// important: At the point of this readyRead(), inflated must be cleared, |
|
583 |
// else implicit sharing will trigger memcpy when the user is reading data! |
|
584 |
emit reply->readyRead(); |
|
585 |
// make sure that the reply is valid |
|
586 |
if (replyPointer.isNull()) |
|
587 |
return true; |
|
588 |
emit reply->dataReadProgress(reply->d_func()->totalProgress, 0); |
|
589 |
// make sure that the reply is valid |
|
590 |
if (replyPointer.isNull()) |
|
591 |
return true; |
|
592 |
||
593 |
} |
|
594 |
} |
|
595 |
} else { |
|
596 |
connection->d_func()->emitReplyError(socket, reply, QNetworkReply::ProtocolFailure); |
|
597 |
return false; |
|
598 |
} |
|
599 |
} |
|
600 |
return true; |
|
601 |
} |
|
602 |
#endif |
|
603 |
||
604 |
||
605 |
void QHttpNetworkConnectionChannel::allDone() |
|
606 |
{ |
|
607 |
#ifndef QT_NO_COMPRESS |
|
608 |
// expand the whole data. |
|
609 |
if (reply->d_func()->expectContent() && reply->d_func()->autoDecompress && !reply->d_func()->streamEnd) |
|
610 |
expand(true); // ### if expand returns false, its an error |
|
611 |
#endif |
|
612 |
// while handling 401 & 407, we might reset the status code, so save this. |
|
613 |
bool emitFinished = reply->d_func()->shouldEmitSignals(); |
|
614 |
handleStatus(); |
|
615 |
// ### at this point there should be no more data on the socket |
|
616 |
// close if server requested |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
617 |
bool connectionCloseEnabled = reply->d_func()->isConnectionCloseEnabled(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
618 |
if (connectionCloseEnabled) |
0 | 619 |
close(); |
620 |
// queue the finished signal, this is required since we might send new requests from |
|
621 |
// slot connected to it. The socket will not fire readyRead signal, if we are already |
|
622 |
// in the slot connected to readyRead |
|
623 |
if (emitFinished) |
|
624 |
QMetaObject::invokeMethod(reply, "finished", Qt::QueuedConnection); |
|
625 |
// reset the reconnection attempts after we receive a complete reply. |
|
626 |
// in case of failures, each channel will attempt two reconnects before emitting error. |
|
627 |
reconnectAttempts = 2; |
|
628 |
||
629 |
detectPipeliningSupport(); |
|
630 |
||
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
631 |
// now the channel can be seen as free/idle again, all signal emissions for the reply have been done |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
632 |
this->state = QHttpNetworkConnectionChannel::IdleState; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
633 |
|
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
634 |
// if it does not need to be sent again we can set it to 0 |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
635 |
// the previous code did not do that and we had problems with accidental re-sending of a |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
636 |
// finished request. |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
637 |
// Note that this may trigger a segfault at some other point. But then we can fix the underlying |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
638 |
// problem. |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
639 |
if (!resendCurrent) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
640 |
reply = 0; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
641 |
|
0 | 642 |
// move next from pipeline to current request |
643 |
if (!alreadyPipelinedRequests.isEmpty()) { |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
644 |
if (resendCurrent || connectionCloseEnabled || socket->state() != QAbstractSocket::ConnectedState) { |
0 | 645 |
// move the pipelined ones back to the main queue |
646 |
requeueCurrentlyPipelinedRequests(); |
|
647 |
close(); |
|
648 |
} else { |
|
649 |
// there were requests pipelined in and we can continue |
|
650 |
HttpMessagePair messagePair = alreadyPipelinedRequests.takeFirst(); |
|
651 |
||
652 |
request = messagePair.first; |
|
653 |
reply = messagePair.second; |
|
654 |
state = QHttpNetworkConnectionChannel::ReadingState; |
|
655 |
resendCurrent = false; |
|
656 |
||
657 |
written = 0; // message body, excluding the header, irrelevant here |
|
658 |
bytesTotal = 0; // message body total, excluding the header, irrelevant here |
|
659 |
||
660 |
// pipeline even more |
|
661 |
connection->d_func()->fillPipeline(socket); |
|
662 |
||
663 |
// continue reading |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
664 |
_q_receiveReply(); |
0 | 665 |
} |
666 |
} else if (alreadyPipelinedRequests.isEmpty() && socket->bytesAvailable() > 0) { |
|
667 |
eatWhitespace(); |
|
668 |
// this is weird. we had nothing pipelined but still bytes available. better close it. |
|
669 |
if (socket->bytesAvailable() > 0) |
|
670 |
close(); |
|
671 |
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); |
|
672 |
} else if (alreadyPipelinedRequests.isEmpty()) { |
|
673 |
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); |
|
674 |
} |
|
675 |
} |
|
676 |
||
677 |
void QHttpNetworkConnectionChannel::detectPipeliningSupport() |
|
678 |
{ |
|
679 |
// detect HTTP Pipelining support |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
680 |
QByteArray serverHeaderField; |
0 | 681 |
if ( |
682 |
// check for HTTP/1.1 |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
683 |
(reply->d_func()->majorVersion == 1 && reply->d_func()->minorVersion == 1) |
0 | 684 |
// check for not having connection close |
685 |
&& (!reply->d_func()->isConnectionCloseEnabled()) |
|
686 |
// check if it is still connected |
|
687 |
&& (socket->state() == QAbstractSocket::ConnectedState) |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
688 |
// check for broken servers in server reply header |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
689 |
// this is adapted from http://mxr.mozilla.org/firefox/ident?i=SupportsPipelining |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
690 |
&& (serverHeaderField = reply->headerField("Server"), !serverHeaderField.contains("Microsoft-IIS/4.")) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
691 |
&& (!serverHeaderField.contains("Microsoft-IIS/5.")) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
692 |
&& (!serverHeaderField.contains("Netscape-Enterprise/3.")) |
0 | 693 |
) { |
694 |
pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningProbablySupported; |
|
695 |
} else { |
|
696 |
pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningSupportUnknown; |
|
697 |
} |
|
698 |
} |
|
699 |
||
700 |
// called when the connection broke and we need to queue some pipelined requests again |
|
701 |
void QHttpNetworkConnectionChannel::requeueCurrentlyPipelinedRequests() |
|
702 |
{ |
|
703 |
for (int i = 0; i < alreadyPipelinedRequests.length(); i++) |
|
704 |
connection->d_func()->requeueRequest(alreadyPipelinedRequests.at(i)); |
|
705 |
alreadyPipelinedRequests.clear(); |
|
706 |
||
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
707 |
// only run when the QHttpNetworkConnection is not currently being destructed, e.g. |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
708 |
// this function is called from _q_disconnected which is called because |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
709 |
// of ~QHttpNetworkConnectionPrivate |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
710 |
if (qobject_cast<QHttpNetworkConnection*>(connection)) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
711 |
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); |
0 | 712 |
} |
713 |
||
714 |
void QHttpNetworkConnectionChannel::eatWhitespace() |
|
715 |
{ |
|
716 |
char c; |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
717 |
do { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
718 |
qint64 ret = socket->peek(&c, 1); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
719 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
720 |
// nothing read, fine. |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
721 |
if (ret == 0) |
0 | 722 |
return; |
723 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
724 |
// EOF from socket? |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
725 |
if (ret == -1) |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
726 |
return; // FIXME, we need to stop processing. however the next stuff done will also do that. |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
727 |
|
0 | 728 |
// read all whitespace and line endings |
729 |
if (c == 11 || c == '\n' || c == '\r' || c == ' ' || c == 31) { |
|
730 |
socket->read(&c, 1); |
|
731 |
continue; |
|
732 |
} else { |
|
733 |
break; |
|
734 |
} |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
735 |
} while(true); |
0 | 736 |
} |
737 |
||
738 |
void QHttpNetworkConnectionChannel::handleStatus() |
|
739 |
{ |
|
740 |
Q_ASSERT(socket); |
|
741 |
Q_ASSERT(reply); |
|
742 |
||
743 |
int statusCode = reply->statusCode(); |
|
744 |
bool resend = false; |
|
745 |
||
746 |
switch (statusCode) { |
|
747 |
case 401: // auth required |
|
748 |
case 407: // proxy auth required |
|
749 |
if (connection->d_func()->handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend)) { |
|
750 |
if (resend) { |
|
5
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
751 |
if (!resetUploadData()) |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
752 |
break; |
0 | 753 |
|
754 |
reply->d_func()->eraseData(); |
|
755 |
||
756 |
if (alreadyPipelinedRequests.isEmpty()) { |
|
757 |
// this does a re-send without closing the connection |
|
758 |
resendCurrent = true; |
|
759 |
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); |
|
760 |
} else { |
|
761 |
// we had requests pipelined.. better close the connection in closeAndResendCurrentRequest |
|
762 |
closeAndResendCurrentRequest(); |
|
763 |
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); |
|
764 |
} |
|
765 |
} |
|
766 |
} else { |
|
767 |
emit reply->headerChanged(); |
|
768 |
emit reply->readyRead(); |
|
769 |
QNetworkReply::NetworkError errorCode = (statusCode == 407) |
|
770 |
? QNetworkReply::ProxyAuthenticationRequiredError |
|
771 |
: QNetworkReply::AuthenticationRequiredError; |
|
772 |
reply->d_func()->errorString = connection->d_func()->errorDetail(errorCode, socket); |
|
773 |
emit connection->error(errorCode, reply->d_func()->errorString); |
|
774 |
emit reply->finished(); |
|
775 |
} |
|
776 |
break; |
|
777 |
default: |
|
778 |
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); |
|
779 |
} |
|
780 |
} |
|
781 |
||
5
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
782 |
bool QHttpNetworkConnectionChannel::resetUploadData() |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
783 |
{ |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
784 |
QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
785 |
if (!uploadByteDevice) |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
786 |
return true; |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
787 |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
788 |
if (uploadByteDevice->reset()) { |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
789 |
written = 0; |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
790 |
return true; |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
791 |
} else { |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
792 |
connection->d_func()->emitReplyError(socket, reply, QNetworkReply::ContentReSendError); |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
793 |
return false; |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
794 |
} |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
795 |
} |
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
796 |
|
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
797 |
|
0 | 798 |
void QHttpNetworkConnectionChannel::pipelineInto(HttpMessagePair &pair) |
799 |
{ |
|
800 |
// this is only called for simple GET |
|
801 |
||
802 |
QHttpNetworkRequest &request = pair.first; |
|
803 |
QHttpNetworkReply *reply = pair.second; |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
804 |
reply->d_func()->clear(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
805 |
reply->d_func()->connection = connection; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
806 |
reply->d_func()->connectionChannel = this; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
807 |
reply->d_func()->autoDecompress = request.d->autoDecompress; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
808 |
reply->d_func()->pipeliningUsed = true; |
0 | 809 |
|
810 |
#ifndef QT_NO_NETWORKPROXY |
|
811 |
QByteArray header = QHttpNetworkRequestPrivate::header(request, |
|
812 |
(connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy)); |
|
813 |
#else |
|
814 |
QByteArray header = QHttpNetworkRequestPrivate::header(request, false); |
|
815 |
#endif |
|
816 |
socket->write(header); |
|
817 |
||
818 |
alreadyPipelinedRequests.append(pair); |
|
819 |
} |
|
820 |
||
821 |
void QHttpNetworkConnectionChannel::closeAndResendCurrentRequest() |
|
822 |
{ |
|
823 |
requeueCurrentlyPipelinedRequests(); |
|
824 |
close(); |
|
825 |
resendCurrent = true; |
|
826 |
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); |
|
827 |
} |
|
828 |
||
829 |
bool QHttpNetworkConnectionChannel::isSocketBusy() const |
|
830 |
{ |
|
831 |
return (state & QHttpNetworkConnectionChannel::BusyState); |
|
832 |
} |
|
833 |
||
834 |
bool QHttpNetworkConnectionChannel::isSocketWriting() const |
|
835 |
{ |
|
836 |
return (state & QHttpNetworkConnectionChannel::WritingState); |
|
837 |
} |
|
838 |
||
839 |
bool QHttpNetworkConnectionChannel::isSocketWaiting() const |
|
840 |
{ |
|
841 |
return (state & QHttpNetworkConnectionChannel::WaitingState); |
|
842 |
} |
|
843 |
||
844 |
bool QHttpNetworkConnectionChannel::isSocketReading() const |
|
845 |
{ |
|
846 |
return (state & QHttpNetworkConnectionChannel::ReadingState); |
|
847 |
} |
|
848 |
||
849 |
//private slots |
|
850 |
void QHttpNetworkConnectionChannel::_q_readyRead() |
|
851 |
{ |
|
852 |
if (isSocketWaiting() || isSocketReading()) { |
|
853 |
state = QHttpNetworkConnectionChannel::ReadingState; |
|
854 |
if (reply) |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
855 |
_q_receiveReply(); |
0 | 856 |
} |
857 |
} |
|
858 |
||
859 |
void QHttpNetworkConnectionChannel::_q_bytesWritten(qint64 bytes) |
|
860 |
{ |
|
861 |
Q_UNUSED(bytes); |
|
862 |
// bytes have been written to the socket. write even more of them :) |
|
863 |
if (isSocketWriting()) |
|
864 |
sendRequest(); |
|
865 |
// otherwise we do nothing |
|
866 |
} |
|
867 |
||
868 |
void QHttpNetworkConnectionChannel::_q_disconnected() |
|
869 |
{ |
|
870 |
// read the available data before closing |
|
871 |
if (isSocketWaiting() || isSocketReading()) { |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
872 |
if (reply) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
873 |
state = QHttpNetworkConnectionChannel::ReadingState; |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
874 |
_q_receiveReply(); |
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
875 |
} |
0 | 876 |
} else if (state == QHttpNetworkConnectionChannel::IdleState && resendCurrent) { |
877 |
// re-sending request because the socket was in ClosingState |
|
878 |
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); |
|
879 |
} |
|
880 |
state = QHttpNetworkConnectionChannel::IdleState; |
|
881 |
||
882 |
requeueCurrentlyPipelinedRequests(); |
|
883 |
close(); |
|
884 |
} |
|
885 |
||
886 |
||
887 |
void QHttpNetworkConnectionChannel::_q_connected() |
|
888 |
{ |
|
889 |
// improve performance since we get the request sent by the kernel ASAP |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
890 |
//socket->setSocketOption(QAbstractSocket::LowDelayOption, 1); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
891 |
// We have this commented out now. It did not have the effect we wanted. If we want to |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
892 |
// do this properly, Qt has to combine multiple HTTP requests into one buffer |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
893 |
// and send this to the kernel in one syscall and then the kernel immediately sends |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
894 |
// it as one TCP packet because of TCP_NODELAY. |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
895 |
// However, this code is currently not in Qt, so we rely on the kernel combining |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
896 |
// the requests into one TCP packet. |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
897 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
898 |
// not sure yet if it helps, but it makes sense |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
899 |
socket->setSocketOption(QAbstractSocket::KeepAliveOption, 1); |
0 | 900 |
|
901 |
pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningSupportUnknown; |
|
902 |
||
903 |
// ### FIXME: if the server closes the connection unexpectedly, we shouldn't send the same broken request again! |
|
904 |
//channels[i].reconnectAttempts = 2; |
|
905 |
if (!pendingEncrypt) { |
|
906 |
state = QHttpNetworkConnectionChannel::IdleState; |
|
907 |
if (reply) |
|
908 |
sendRequest(); |
|
909 |
else |
|
910 |
close(); |
|
911 |
} |
|
912 |
} |
|
913 |
||
914 |
||
915 |
void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socketError) |
|
916 |
{ |
|
917 |
if (!socket) |
|
918 |
return; |
|
919 |
bool send2Reply = false; |
|
920 |
QNetworkReply::NetworkError errorCode = QNetworkReply::UnknownNetworkError; |
|
921 |
||
922 |
switch (socketError) { |
|
923 |
case QAbstractSocket::HostNotFoundError: |
|
924 |
errorCode = QNetworkReply::HostNotFoundError; |
|
925 |
break; |
|
926 |
case QAbstractSocket::ConnectionRefusedError: |
|
927 |
errorCode = QNetworkReply::ConnectionRefusedError; |
|
928 |
break; |
|
929 |
case QAbstractSocket::RemoteHostClosedError: |
|
930 |
// try to reconnect/resend before sending an error. |
|
931 |
// while "Reading" the _q_disconnected() will handle this. |
|
932 |
if (state != QHttpNetworkConnectionChannel::IdleState && state != QHttpNetworkConnectionChannel::ReadingState) { |
|
933 |
if (reconnectAttempts-- > 0) { |
|
934 |
closeAndResendCurrentRequest(); |
|
935 |
return; |
|
936 |
} else { |
|
937 |
send2Reply = true; |
|
938 |
errorCode = QNetworkReply::RemoteHostClosedError; |
|
939 |
} |
|
940 |
} else { |
|
941 |
return; |
|
942 |
} |
|
943 |
break; |
|
944 |
case QAbstractSocket::SocketTimeoutError: |
|
945 |
// try to reconnect/resend before sending an error. |
|
946 |
if (state == QHttpNetworkConnectionChannel::WritingState && (reconnectAttempts-- > 0)) { |
|
947 |
closeAndResendCurrentRequest(); |
|
948 |
return; |
|
949 |
} |
|
950 |
send2Reply = true; |
|
951 |
errorCode = QNetworkReply::TimeoutError; |
|
952 |
break; |
|
953 |
case QAbstractSocket::ProxyAuthenticationRequiredError: |
|
954 |
errorCode = QNetworkReply::ProxyAuthenticationRequiredError; |
|
955 |
break; |
|
956 |
case QAbstractSocket::SslHandshakeFailedError: |
|
957 |
errorCode = QNetworkReply::SslHandshakeFailedError; |
|
958 |
break; |
|
959 |
default: |
|
960 |
// all other errors are treated as NetworkError |
|
961 |
errorCode = QNetworkReply::UnknownNetworkError; |
|
962 |
break; |
|
963 |
} |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
964 |
QPointer<QHttpNetworkConnection> that = connection; |
5
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
965 |
QString errorString = connection->d_func()->errorDetail(errorCode, socket, socket->errorString()); |
0 | 966 |
if (send2Reply) { |
967 |
if (reply) { |
|
968 |
reply->d_func()->errorString = errorString; |
|
969 |
// this error matters only to this reply |
|
970 |
emit reply->finishedWithError(errorCode, errorString); |
|
971 |
} |
|
972 |
// send the next request |
|
973 |
QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection); |
|
974 |
} else { |
|
975 |
// the failure affects all requests. |
|
976 |
emit connection->error(errorCode, errorString); |
|
977 |
} |
|
978 |
if (that) //signal emission triggered event loop |
|
979 |
close(); |
|
980 |
} |
|
981 |
||
982 |
#ifndef QT_NO_NETWORKPROXY |
|
983 |
void QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator* auth) |
|
984 |
{ |
|
985 |
connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth); |
|
986 |
} |
|
987 |
#endif |
|
988 |
||
989 |
void QHttpNetworkConnectionChannel::_q_uploadDataReadyRead() |
|
990 |
{ |
|
991 |
sendRequest(); |
|
992 |
} |
|
993 |
||
994 |
#ifndef QT_NO_OPENSSL |
|
995 |
void QHttpNetworkConnectionChannel::_q_encrypted() |
|
996 |
{ |
|
997 |
if (!socket) |
|
998 |
return; // ### error |
|
999 |
state = QHttpNetworkConnectionChannel::IdleState; |
|
1000 |
sendRequest(); |
|
1001 |
} |
|
1002 |
||
1003 |
void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors) |
|
1004 |
{ |
|
1005 |
if (!socket) |
|
1006 |
return; |
|
1007 |
//QNetworkReply::NetworkError errorCode = QNetworkReply::ProtocolFailure; |
|
1008 |
emit connection->sslErrors(errors); |
|
1009 |
} |
|
1010 |
||
1011 |
void QHttpNetworkConnectionChannel::_q_encryptedBytesWritten(qint64 bytes) |
|
1012 |
{ |
|
1013 |
Q_UNUSED(bytes); |
|
1014 |
// bytes have been written to the socket. write even more of them :) |
|
1015 |
if (isSocketWriting()) |
|
1016 |
sendRequest(); |
|
1017 |
// otherwise we do nothing |
|
1018 |
} |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
1019 |
|
0 | 1020 |
#endif |
1021 |
||
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
1022 |
void QHttpNetworkConnectionChannel::setConnection(QHttpNetworkConnection *c) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
1023 |
{ |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
1024 |
// Inlining this function in the header leads to compiler error on |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
1025 |
// release-armv5, on at least timebox 9.2 and 10.1. |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
1026 |
connection = c; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
1027 |
} |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
5
diff
changeset
|
1028 |
|
0 | 1029 |
QT_END_NAMESPACE |
1030 |
||
1031 |
#include "moc_qhttpnetworkconnectionchannel_p.cpp" |
|
1032 |
||
1033 |
#endif // QT_NO_HTTP |