Qt 4.8
qhttpthreaddelegate.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtNetwork module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 //#define QHTTPTHREADDELEGATE_DEBUG
43 #include "qhttpthreaddelegate_p.h"
44 
45 #include <QThread>
46 #include <QTimer>
47 #include <QAuthenticator>
48 #include <QEventLoop>
49 
50 #include "private/qhttpnetworkreply_p.h"
51 #include "private/qnetworkaccesscache_p.h"
52 #include "private/qnoncontiguousbytedevice_p.h"
53 
54 #ifndef QT_NO_HTTP
55 
57 
58 static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url)
59 {
61  // we've got an error
62  switch (httpStatusCode) {
63  case 401: // Authorization required
65  break;
66 
67  case 403: // Access denied
69  break;
70 
71  case 404: // Not Found
73  break;
74 
75  case 405: // Method Not Allowed
77  break;
78 
79  case 407:
81  break;
82 
83  case 418: // I'm a teapot
85  break;
86 
87 
88  default:
89  if (httpStatusCode > 500) {
90  // some kind of server error
92  } else if (httpStatusCode >= 400) {
93  // content error we did not handle above
95  } else {
96  qWarning("QNetworkAccess: got HTTP status code %d which is not expected from url: \"%s\"",
97  httpStatusCode, qPrintable(url.toString()));
99  }
100  }
101 
102  return code;
103 }
104 
105 
107 {
108  QByteArray result;
109  QUrl copy = url;
110  bool isEncrypted = copy.scheme().toLower() == QLatin1String("https");
111  copy.setPort(copy.port(isEncrypted ? 443 : 80));
114 
115 #ifndef QT_NO_NETWORKPROXY
116  if (proxy && proxy->type() != QNetworkProxy::NoProxy) {
117  QUrl key;
118 
119  switch (proxy->type()) {
121  key.setScheme(QLatin1String("proxy-socks5"));
122  break;
123 
126  key.setScheme(QLatin1String("proxy-http"));
127  break;
128 
129  default:
130  break;
131  }
132 
133  if (!key.scheme().isEmpty()) {
134  key.setUserName(proxy->user());
135  key.setHost(proxy->hostName());
136  key.setPort(proxy->port());
137  key.setEncodedQuery(result);
138  result = key.toEncoded();
139  }
140  }
141 #else
142  Q_UNUSED(proxy)
143 #endif
144 
145  return "http-connection:" + result;
146 }
147 
150 {
151  // Q_OBJECT
152 public:
153 #ifdef QT_NO_BEARERMANAGEMENT
155  : QHttpNetworkConnection(hostName, port, encrypt)
156 #else
157  QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt, QSharedPointer<QNetworkSession> networkSession)
158  : QHttpNetworkConnection(hostName, port, encrypt, /*parent=*/0, networkSession)
159 #endif
160  {
161  setExpires(true);
162  setShareable(true);
163  }
164 
165  virtual void dispose()
166  {
167 #if 0 // sample code; do this right with the API
168  Q_ASSERT(!isWorking());
169 #endif
170  delete this;
171  }
172 };
173 
174 
176 
177 
179 {
180  // It could be that the main thread has asked us to shut down, so we need to delete the HTTP reply
181  if (httpReply) {
182  delete httpReply;
183  }
184 
185  // Get the object cache that stores our QHttpNetworkConnection objects
186  // and release the entry for this QHttpNetworkConnection
187  if (connections.hasLocalData() && !cacheKey.isEmpty()) {
188  connections.localData()->releaseEntry(cacheKey);
189  }
190 }
191 
192 
194  QObject(parent)
195  , ssl(false)
196  , downloadBufferMaximumSize(0)
197  , readBufferMaxSize(0)
198  , bytesEmitted(0)
199  , pendingDownloadData(0)
200  , pendingDownloadProgress(0)
201  , synchronous(false)
202  , incomingStatusCode(0)
203  , isPipeliningUsed(false)
204  , incomingContentLength(-1)
205  , incomingErrorCode(QNetworkReply::NoError)
206  , downloadBuffer(0)
207  , httpConnection(0)
208  , httpReply(0)
209  , synchronousRequestLoop(0)
210 {
211 }
212 
213 // This is invoked as BlockingQueuedConnection from QNetworkAccessHttpBackend in the user thread
215 {
216 #ifdef QHTTPTHREADDELEGATE_DEBUG
217  qDebug() << "QHttpThreadDelegate::startRequestSynchronously() thread=" << QThread::currentThreadId();
218 #endif
219  synchronous = true;
220 
222  this->synchronousRequestLoop = &synchronousRequestLoop;
223 
224  // Worst case timeout
225  QTimer::singleShot(30*1000, this, SLOT(abortRequest()));
226 
227  QMetaObject::invokeMethod(this, "startRequest", Qt::QueuedConnection);
228  synchronousRequestLoop.exec();
229 
232 
233 #ifdef QHTTPTHREADDELEGATE_DEBUG
234  qDebug() << "QHttpThreadDelegate::startRequestSynchronously() thread=" << QThread::currentThreadId() << "finished";
235 #endif
236 }
237 
238 
239 // This is invoked as QueuedConnection from QNetworkAccessHttpBackend in the user thread
241 {
242 #ifdef QHTTPTHREADDELEGATE_DEBUG
243  qDebug() << "QHttpThreadDelegate::startRequest() thread=" << QThread::currentThreadId();
244 #endif
245  // Check QThreadStorage for the QNetworkAccessCache
246  // If not there, create this connection cache
247  if (!connections.hasLocalData()) {
249  }
250 
251  // check if we have an open connection to this host
252  QUrl urlCopy = httpRequest.url();
253  urlCopy.setPort(urlCopy.port(ssl ? 443 : 80));
254 
255 #ifndef QT_NO_NETWORKPROXY
258  else if (cacheProxy.type() != QNetworkProxy::NoProxy)
259  cacheKey = makeCacheKey(urlCopy, &cacheProxy);
260  else
261 #endif
262  cacheKey = makeCacheKey(urlCopy, 0);
263 
264 
265  // the http object is actually a QHttpNetworkConnection
267  if (httpConnection == 0) {
268  // no entry in cache; create an object
269  // the http object is actually a QHttpNetworkConnection
270 #ifdef QT_NO_BEARERMANAGEMENT
271  httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl);
272 #else
274 #endif
275 #ifndef QT_NO_OPENSSL
276  // Set the QSslConfiguration from this QNetworkRequest.
279  }
280 #endif
281 
282 #ifndef QT_NO_NETWORKPROXY
283  httpConnection->setTransparentProxy(transparentProxy);
284  httpConnection->setCacheProxy(cacheProxy);
285 #endif
286 
287  // cache the QHttpNetworkConnection corresponding to this cache key
288  connections.localData()->addEntry(cacheKey, httpConnection);
289  }
290 
291 
292  // Send the request to the connection
294  httpReply->setParent(this);
295 
296  // Connect the reply signals that we need to handle and then forward
297  if (synchronous) {
298  connect(httpReply,SIGNAL(headerChanged()), this, SLOT(synchronousHeaderChangedSlot()));
299  connect(httpReply,SIGNAL(finished()), this, SLOT(synchronousFinishedSlot()));
300  connect(httpReply,SIGNAL(finishedWithError(QNetworkReply::NetworkError, const QString)),
302 
307 
308  // Don't care about ignored SSL errors for now in the synchronous HTTP case.
309  } else if (!synchronous) {
310  connect(httpReply,SIGNAL(headerChanged()), this, SLOT(headerChangedSlot()));
311  connect(httpReply,SIGNAL(finished()), this, SLOT(finishedSlot()));
312  connect(httpReply,SIGNAL(finishedWithError(QNetworkReply::NetworkError, const QString)),
314  // some signals are only interesting when normal asynchronous style is used
315  connect(httpReply,SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
316  connect(httpReply,SIGNAL(dataReadProgress(int, int)), this, SLOT(dataReadProgressSlot(int,int)));
317 #ifndef QT_NO_OPENSSL
319 #endif
320 
321  // In the asynchronous HTTP case we can just forward those signals
322  // Connect the reply signals that we can directly forward
327  }
328 
331 }
332 
333 // This gets called from the user thread or by the synchronous HTTP timeout timer
335 {
336 #ifdef QHTTPTHREADDELEGATE_DEBUG
337  qDebug() << "QHttpThreadDelegate::abortRequest() thread=" << QThread::currentThreadId() << "sync=" << synchronous;
338 #endif
339  if (httpReply) {
340  delete httpReply;
341  httpReply = 0;
342  }
343 
344  // Got aborted by the timeout timer
345  if (synchronous) {
348  } else {
349  //only delete this for asynchronous mode or QNetworkAccessHttpBackend will crash - see QNetworkAccessHttpBackend::postRequest()
350  this->deleteLater();
351  }
352 }
353 
355 {
356 #ifdef QHTTPTHREADDELEGATE_DEBUG
357  qDebug() << "QHttpThreadDelegate::readBufferSizeChanged() size " << size;
358 #endif
359  if (httpReply) {
362  readBufferMaxSize = size;
363  }
364 }
365 
367 {
368  if (readBufferMaxSize) {
369  bytesEmitted -= size;
370 
371  QMetaObject::invokeMethod(this, "readyReadSlot", Qt::QueuedConnection);
372  }
373 }
374 
376 {
377  if (!httpReply)
378  return;
379 
380  // Don't do in zerocopy case
381  if (!downloadBuffer.isNull())
382  return;
383 
384  if (readBufferMaxSize) {
386  qint64 sizeEmitted = 0;
387  while (httpReply->readAnyAvailable() && (sizeEmitted < (readBufferMaxSize-bytesEmitted))) {
389  sizeEmitted = readBufferMaxSize-bytesEmitted;
390  bytesEmitted += sizeEmitted;
392  emit downloadData(httpReply->read(sizeEmitted));
393  } else {
394  sizeEmitted = httpReply->sizeNextBlock();
395  bytesEmitted += sizeEmitted;
398  }
399  }
400  } else {
401  // We need to wait until we empty data from the read buffer in the reply.
402  }
403  } else {
404  while (httpReply->readAnyAvailable()) {
407  }
408  }
409 }
410 
412 {
413  if (!httpReply)
414  return;
415 
416 #ifdef QHTTPTHREADDELEGATE_DEBUG
417  qDebug() << "QHttpThreadDelegate::finishedSlot() thread=" << QThread::currentThreadId() << "result=" << httpReply->statusCode();
418 #endif
419 
420  // If there is still some data left emit that now
421  while (httpReply->readAnyAvailable()) {
424  }
425 
426 #ifndef QT_NO_OPENSSL
427  if (ssl)
429 #endif
430 
431  if (httpReply->statusCode() >= 400) {
432  // it's an error reply
433  QString msg = QLatin1String(QT_TRANSLATE_NOOP("QNetworkReply",
434  "Error downloading %1 - server replied: %2"));
437  }
438 
440 
442  QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection);
443  httpReply = 0;
444 }
445 
447 {
448  if (!httpReply)
449  return;
450 
451 #ifdef QHTTPTHREADDELEGATE_DEBUG
452  qDebug() << "QHttpThreadDelegate::synchronousFinishedSlot() thread=" << QThread::currentThreadId() << "result=" << httpReply->statusCode();
453 #endif
454  if (httpReply->statusCode() >= 400) {
455  // it's an error reply
456  QString msg = QLatin1String(QT_TRANSLATE_NOOP("QNetworkReply",
457  "Error downloading %1 - server replied: %2"));
460  }
461 
463 
466  httpReply = 0;
467 }
468 
470 {
471  if (!httpReply)
472  return;
473 
474 #ifdef QHTTPTHREADDELEGATE_DEBUG
475  qDebug() << "QHttpThreadDelegate::finishedWithErrorSlot() thread=" << QThread::currentThreadId() << "error=" << errorCode << detail;
476 #endif
477 
478 #ifndef QT_NO_OPENSSL
479  if (ssl)
481 #endif
482  emit error(errorCode,detail);
484 
485 
487  QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection);
488  httpReply = 0;
489 }
490 
491 
493 {
494  if (!httpReply)
495  return;
496 
497 #ifdef QHTTPTHREADDELEGATE_DEBUG
498  qDebug() << "QHttpThreadDelegate::synchronousFinishedWithErrorSlot() thread=" << QThread::currentThreadId() << "error=" << errorCode << detail;
499 #endif
500  incomingErrorCode = errorCode;
501  incomingErrorDetail = detail;
502 
505  httpReply = 0;
506 }
507 
508 static void downloadBufferDeleter(char *ptr)
509 {
510  delete[] ptr;
511 }
512 
514 {
515  if (!httpReply)
516  return;
517 
518 #ifdef QHTTPTHREADDELEGATE_DEBUG
519  qDebug() << "QHttpThreadDelegate::headerChangedSlot() thread=" << QThread::currentThreadId();
520 #endif
521 
522 #ifndef QT_NO_OPENSSL
523  if (ssl)
525 #endif
526 
527  // Is using a zerocopy buffer allowed by user and possible with this reply?
529  && downloadBufferMaximumSize > 0) {
530  char *buf = new char[httpReply->contentLength()]; // throws if allocation fails
531  if (buf) {
534  }
535  }
536 
537  // We fetch this into our own
543 
550 }
551 
553 {
554  if (!httpReply)
555  return;
556 
557 #ifdef QHTTPTHREADDELEGATE_DEBUG
558  qDebug() << "QHttpThreadDelegate::synchronousHeaderChangedSlot() thread=" << QThread::currentThreadId();
559 #endif
560  // Store the information we need in this object, the QNetworkAccessHttpBackend will later read it
566 }
567 
568 
570 {
571  // If we don't have a download buffer don't attempt to go this codepath
572  // It is not used by QNetworkAccessHttpBackend
573  if (downloadBuffer.isNull())
574  return;
575 
577  emit downloadProgress(done, total);
578 }
579 
581 {
582  authenticationManager->cacheCredentials(request.url(), authenticator);
583 }
584 
585 
586 #ifndef QT_NO_OPENSSL
588 {
589  if (!httpReply)
590  return;
591 
593 
594  bool ignoreAll = false;
595  QList<QSslError> specificErrors;
596  emit sslErrors(errors, &ignoreAll, &specificErrors);
597  if (ignoreAll)
599  if (!specificErrors.isEmpty())
600  httpReply->ignoreSslErrors(specificErrors);
601 }
602 #endif
603 
605 {
606  if (!httpReply)
607  return;
608 
609  Q_UNUSED(request);
610 #ifdef QHTTPTHREADDELEGATE_DEBUG
611  qDebug() << "QHttpThreadDelegate::synchronousAuthenticationRequiredSlot() thread=" << QThread::currentThreadId();
612 #endif
613 
614  // Ask the credential cache
616  if (!credential.isNull()) {
617  a->setUser(credential.user);
618  a->setPassword(credential.password);
619  }
620 
621  // Disconnect this connection now since we only want to ask the authentication cache once.
624 }
625 
626 #ifndef QT_NO_NETWORKPROXY
628 {
629  if (!httpReply)
630  return;
631 
632 #ifdef QHTTPTHREADDELEGATE_DEBUG
633  qDebug() << "QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot() thread=" << QThread::currentThreadId();
634 #endif
635  // Ask the credential cache
637  if (!credential.isNull()) {
638  a->setUser(credential.user);
639  a->setPassword(credential.password);
640  }
641 
642  // Disconnect this connection now since we only want to ask the authentication cache once.
645 }
646 
647 #endif
648 
649 #endif // QT_NO_HTTP
650 
QNetworkReply::NetworkError incomingErrorCode
QNetworkProxy::ProxyType type() const
Returns the proxy type for this instance.
QSharedPointer< char > downloadBuffer
static void downloadBufferDeleter(char *ptr)
void setDownstreamLimited(bool t)
static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url)
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
Definition: qstring.cpp:4276
static QThreadStorage< QNetworkAccessCache * > connections
QString reasonPhrase() const
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
Definition: qurl.cpp:5896
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
Definition: qnetworkreply.h:65
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
bool readAnyAvailable() const
QList< QPair< QByteArray, QByteArray > > header() const
void synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail=QString())
#define SLOT(a)
Definition: qobjectdefs.h:226
QHttpNetworkRequest httpRequest
QSslConfiguration incomingSslConfiguration
NetworkError
Indicates all possible error conditions found during the processing of the request.
Definition: qnetworkreply.h:70
void downloadMetaData(QList< QPair< QByteArray, QByteArray > >, int, QString, bool, QSharedPointer< char >, qint64)
void setTransparentProxy(const QNetworkProxy &networkProxy)
#define QT_TRANSLATE_NOOP(scope, x)
Marks the string literal sourceText for dynamic translation in the given context; i...
Definition: qglobal.h:2487
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
long ASN1_INTEGER_get ASN1_INTEGER * a
void dataReadProgressSlot(int done, int total)
CacheableObject * requestEntryNow(const QByteArray &key)
void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)
bool isPipeliningUsed() const
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString host() const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
Definition: qurl.cpp:4837
void setUser(const QString &user)
Sets the user used for authentication.
void downloadProgress(qint64, qint64)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
bool supportsUserProvidedDownloadBuffer()
void setHost(const QString &host)
Sets the host of the URL to host.
Definition: qurl.cpp:4821
void sslErrors(const QList< QSslError > &, bool *, QList< QSslError > *)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
void setParent(QObject *)
Makes the object a child of parent.
Definition: qobject.cpp:1950
void setCacheProxy(const QNetworkProxy &networkProxy)
Q_CORE_EXPORT void qDebug(const char *,...)
int port() const
Returns the port of the URL, or -1 if the port is unspecified.
Definition: qurl.cpp:4916
#define SIGNAL(a)
Definition: qobjectdefs.h:227
The QNetworkProxy class provides a network layer proxy.
QNetworkAuthenticationCredential fetchCachedCredentials(const QUrl &url, const QAuthenticator *auth=0)
Fetch the credential data from the credential cache.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
void addEntry(const QByteArray &key, CacheableObject *entry)
The QEventLoop class provides a means of entering and leaving an event loop.
Definition: qeventloop.h:55
QEventLoop * synchronousRequestLoop
void error(QNetworkReply::NetworkError, const QString)
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QByteArray read(qint64 amount)
void sslConfigurationChanged(const QSslConfiguration)
T & localData()
Returns a reference to the data that was set by the calling thread.
#define emit
Definition: qobjectdefs.h:76
unsigned short quint16
Definition: qglobal.h:936
Q_CORE_EXPORT void qWarning(const char *,...)
QHttpThreadDelegate(QObject *parent=0)
static QSslConfiguration defaultConfiguration()
Returns the default SSL configuration to be used in new SSL connections.
const T * ptr(const T &t)
__int64 qint64
Definition: qglobal.h:942
void setReadBufferSize(qint64 size)
QNetworkAccessCachedHttpConnection * httpConnection
The QAuthenticator class provides an authentication object.
static QByteArray makeCacheKey(QUrl &url, QNetworkProxy *proxy)
QByteArray toEncoded(FormattingOptions options=None) const
Returns the encoded representation of the URL if it&#39;s valid; otherwise an empty QByteArray is returne...
Definition: qurl.cpp:5949
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
Definition: qobject.cpp:2895
QString scheme() const
Returns the scheme of the URL.
Definition: qurl.cpp:4550
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
bool hasLocalData() const
If T is a pointer type, returns true if the calling thread has non-zero data available.
void setPort(int port)
Sets the port of the URL to port.
Definition: qurl.cpp:4897
QHttpNetworkConnection(const QString &hostName, quint16 port=80, bool encrypt=false, QObject *parent=0, QSharedPointer< QNetworkSession > networkSession=QSharedPointer< QNetworkSession >())
void setLocalData(T t)
Sets the local data for the calling thread to data.
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QSharedPointer< QNetworkSession > networkSession
void readBufferFreed(qint64 size)
int key
bool singleShot
This static function calls a slot after a given time interval.
Definition: qtimer.h:59
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
Definition: qstring.cpp:5389
quint16 port() const
Returns the port of the proxy host.
qint64 contentLength() const
void finishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail=QString())
void downloadData(QByteArray)
void synchronousProxyAuthenticationRequiredSlot(const QNetworkProxy &, QAuthenticator *)
QSharedPointer< QAtomicInt > pendingDownloadProgress
void setScheme(const QString &scheme)
Sets the scheme of the URL to scheme.
Definition: qurl.cpp:4533
QSharedPointer< QNetworkAccessAuthenticationManager > authenticationManager
void setSslConfiguration(const QSslConfiguration &config)
QHttpNetworkReply * sendRequest(const QHttpNetworkRequest &request)
QList< QPair< QByteArray, QByteArray > > incomingHeaders
void readBufferSizeChanged(qint64 size)
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
Invokes the member (a signal or a slot name) on the object obj.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
void cacheCredentials(const QUrl &url, const QAuthenticator *auth)
void releaseEntry(const QByteArray &key)
void setPassword(const QString &password)
Sets the password used for authentication.
void authenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *)
void setUserProvidedDownloadBuffer(char *)
QNetworkAuthenticationCredential fetchCachedProxyCredentials(const QNetworkProxy &proxy, const QAuthenticator *auth=0)
QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt, QSharedPointer< QNetworkSession > networkSession)
QString user() const
Returns the user name used for authentication.
void synchronousAuthenticationRequiredSlot(const QHttpNetworkRequest &request, QAuthenticator *)
void cacheCredentialsSlot(const QHttpNetworkRequest &request, QAuthenticator *authenticator)
QHttpNetworkReply * httpReply
void setUserName(const QString &userName)
Sets the URL&#39;s user name to userName.
Definition: qurl.cpp:4648
#define qPrintable(string)
Definition: qglobal.h:1750
bool isNull() const
Returns true if this object is holding a reference to a null pointer.
The QThreadStorage class provides per-thread data storage.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
void deleteLater()
Schedules this object for deletion.
Definition: qobject.cpp:2145
QSslConfiguration sslConfiguration() const
int exec(ProcessEventsFlags flags=AllEvents)
Enters the main event loop and waits until exit() is called.
Definition: qeventloop.cpp:181
void sslErrorsSlot(const QList< QSslError > &errors)
QSharedPointer< QAtomicInt > pendingDownloadData
int fetchAndAddRelease(int valueToAdd)
Atomic fetch-and-add.
void setEncodedQuery(const QByteArray &query)
Sets the query string of the URL to query.
Definition: qurl.cpp:5136
static Qt::HANDLE currentThreadId()
Returns the thread handle of the currently executing thread.
QString hostName() const
Returns the host name of the proxy host.