47 #include <QAuthenticator> 50 #include "private/qhttpnetworkreply_p.h" 51 #include "private/qnetworkaccesscache_p.h" 52 #include "private/qnoncontiguousbytedevice_p.h" 62 switch (httpStatusCode) {
89 if (httpStatusCode > 500) {
92 }
else if (httpStatusCode >= 400) {
96 qWarning(
"QNetworkAccess: got HTTP status code %d which is not expected from url: \"%s\"",
115 #ifndef QT_NO_NETWORKPROXY 119 switch (proxy->
type()) {
145 return "http-connection:" + result;
153 #ifdef QT_NO_BEARERMANAGEMENT 167 #if 0 // sample code; do this right with the API 188 connections.localData()->releaseEntry(
cacheKey);
196 , downloadBufferMaximumSize(0)
197 , readBufferMaxSize(0)
199 , pendingDownloadData(0)
200 , pendingDownloadProgress(0)
202 , incomingStatusCode(0)
203 , isPipeliningUsed(false)
204 , incomingContentLength(-1)
209 , synchronousRequestLoop(0)
216 #ifdef QHTTPTHREADDELEGATE_DEBUG 228 synchronousRequestLoop.
exec();
233 #ifdef QHTTPTHREADDELEGATE_DEBUG 242 #ifdef QHTTPTHREADDELEGATE_DEBUG 255 #ifndef QT_NO_NETWORKPROXY 270 #ifdef QT_NO_BEARERMANAGEMENT 275 #ifndef QT_NO_OPENSSL 282 #ifndef QT_NO_NETWORKPROXY 317 #ifndef QT_NO_OPENSSL 336 #ifdef QHTTPTHREADDELEGATE_DEBUG 356 #ifdef QHTTPTHREADDELEGATE_DEBUG 357 qDebug() <<
"QHttpThreadDelegate::readBufferSizeChanged() size " << size;
390 bytesEmitted += sizeEmitted;
416 #ifdef QHTTPTHREADDELEGATE_DEBUG 426 #ifndef QT_NO_OPENSSL 434 "Error downloading %1 - server replied: %2"));
451 #ifdef QHTTPTHREADDELEGATE_DEBUG 457 "Error downloading %1 - server replied: %2"));
474 #ifdef QHTTPTHREADDELEGATE_DEBUG 478 #ifndef QT_NO_OPENSSL 497 #ifdef QHTTPTHREADDELEGATE_DEBUG 518 #ifdef QHTTPTHREADDELEGATE_DEBUG 522 #ifndef QT_NO_OPENSSL 557 #ifdef QHTTPTHREADDELEGATE_DEBUG 586 #ifndef QT_NO_OPENSSL 594 bool ignoreAll =
false;
610 #ifdef QHTTPTHREADDELEGATE_DEBUG 616 if (!credential.
isNull()) {
626 #ifndef QT_NO_NETWORKPROXY 632 #ifdef QHTTPTHREADDELEGATE_DEBUG 637 if (!credential.
isNull()) {
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.
QNetworkProxy transparentProxy
void synchronousFinishedSlot()
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
static QThreadStorage< QNetworkAccessCache * > connections
QString reasonPhrase() const
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
The QByteArray class provides an array of bytes.
bool readAnyAvailable() const
QList< QPair< QByteArray, QByteArray > > header() const
void synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail=QString())
QHttpNetworkRequest httpRequest
QSslConfiguration incomingSslConfiguration
NetworkError
Indicates all possible error conditions found during the processing of the request.
QString incomingErrorDetail
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...
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.
The QString class provides a Unicode character string.
QString host() const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
void setUser(const QString &user)
Sets the user used for authentication.
void downloadProgress(qint64, qint64)
The QObject class is the base class of all Qt objects.
qint64 downloadBufferMaximumSize
bool supportsUserProvidedDownloadBuffer()
void setHost(const QString &host)
Sets the host of the URL to host.
void sslErrors(const QList< QSslError > &, bool *, QList< QSslError > *)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
void setParent(QObject *)
Makes the object a child of parent.
void synchronousHeaderChangedSlot()
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.
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.
void addEntry(const QByteArray &key, CacheableObject *entry)
The QEventLoop class provides a means of entering and leaving an event loop.
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...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QByteArray read(qint64 amount)
void sslConfigurationChanged(const QSslConfiguration)
T & localData()
Returns a reference to the data that was set by the calling thread.
Q_CORE_EXPORT void qWarning(const char *,...)
QHttpThreadDelegate(QObject *parent=0)
qint64 incomingContentLength
static QSslConfiguration defaultConfiguration()
Returns the default SSL configuration to be used in new SSL connections.
const T * ptr(const T &t)
void setReadBufferSize(qint64 size)
QNetworkAccessCachedHttpConnection * httpConnection
void startRequestSynchronously()
QByteArray synchronousDownloadData
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's valid; otherwise an empty QByteArray is returne...
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.
QByteArray cacheKey() const
QString scheme() const
Returns the scheme of the URL.
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
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.
QHttpNetworkConnection(const QString &hostName, quint16 port=80, bool encrypt=false, QObject *parent=0, QSharedPointer< QNetworkSession > networkSession=QSharedPointer< QNetworkSession >())
void setExpires(bool enable)
void setLocalData(T t)
Sets the local data for the calling thread to data.
QObject * parent() const
Returns a pointer to the parent object.
QSharedPointer< QNetworkSession > networkSession
void readBufferFreed(qint64 size)
bool singleShot
This static function calls a slot after a given time interval.
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
quint16 port() const
Returns the port of the proxy host.
qint64 contentLength() const
void finishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail=QString())
void setShareable(bool enable)
void downloadData(QByteArray)
void synchronousProxyAuthenticationRequiredSlot(const QNetworkProxy &, QAuthenticator *)
QSharedPointer< QAtomicInt > pendingDownloadProgress
void setScheme(const QString &scheme)
Sets the scheme of the URL to scheme.
QSharedPointer< QNetworkAccessAuthenticationManager > authenticationManager
void setSslConfiguration(const QSslConfiguration &config)
QHttpNetworkReply * sendRequest(const QHttpNetworkRequest &request)
QList< QPair< QByteArray, QByteArray > > incomingHeaders
void readBufferSizeChanged(qint64 size)
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
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 *)
QString incomingReasonPhrase
void cacheCredentialsSlot(const QHttpNetworkRequest &request, QAuthenticator *authenticator)
QHttpNetworkReply * httpReply
void setUserName(const QString &userName)
Sets the URL's user name to userName.
#define qPrintable(string)
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...
void deleteLater()
Schedules this object for deletion.
QSslConfiguration sslConfiguration() const
int exec(ProcessEventsFlags flags=AllEvents)
Enters the main event loop and waits until exit() is called.
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.
static Qt::HANDLE currentThreadId()
Returns the thread handle of the currently executing thread.
QString hostName() const
Returns the host name of the proxy host.