Qt 4.8
Public Types | Public Functions | Public Variables | Static Public Variables | Friends | List of all members
QHttpNetworkConnectionPrivate Class Reference

#include <qhttpnetworkconnection_p.h>

Inheritance diagram for QHttpNetworkConnectionPrivate:
QObjectPrivate QObjectData

Public Types

enum  { ChunkSize = 4096 }
 
enum  ConnectionState { RunningState = 0, PausedState = 1 }
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 

Public Functions

void _q_startNextRequest ()
 
void copyCredentials (int fromChannel, QAuthenticator *auth, bool isProxy)
 
void createAuthorization (QAbstractSocket *socket, QHttpNetworkRequest &request)
 
bool dequeueRequest (QAbstractSocket *socket)
 
void emitProxyAuthenticationRequired (const QHttpNetworkConnectionChannel *chan, const QNetworkProxy &proxy, QAuthenticator *auth)
 
void emitReplyError (QAbstractSocket *socket, QHttpNetworkReply *reply, QNetworkReply::NetworkError errorCode)
 
QString errorDetail (QNetworkReply::NetworkError errorCode, QAbstractSocket *socket, const QString &extraDetail=QString())
 
bool expand (QAbstractSocket *socket, QHttpNetworkReply *reply, bool dataComplete)
 
void fillPipeline (QAbstractSocket *socket)
 
bool fillPipeline (QList< HttpMessagePair > &queue, QHttpNetworkConnectionChannel &channel)
 
bool handleAuthenticateChallenge (QAbstractSocket *socket, QHttpNetworkReply *reply, bool isProxy, bool &resend)
 
int indexOf (QAbstractSocket *socket) const
 
void init ()
 
void pauseConnection ()
 
QHttpNetworkRequest predictNextRequest ()
 
void prepareRequest (HttpMessagePair &request)
 
 QHttpNetworkConnectionPrivate (const QString &hostName, quint16 port, bool encrypt)
 
 QHttpNetworkConnectionPrivate (quint16 channelCount, const QString &hostName, quint16 port, bool encrypt)
 
QHttpNetworkReplyqueueRequest (const QHttpNetworkRequest &request)
 
void readMoreLater (QHttpNetworkReply *reply)
 
void removeReply (QHttpNetworkReply *reply)
 
void requeueRequest (const HttpMessagePair &pair)
 
void resumeConnection ()
 
qint64 uncompressedBytesAvailable (const QHttpNetworkReply &reply) const
 
qint64 uncompressedBytesAvailableNextBlock (const QHttpNetworkReply &reply) const
 
 ~QHttpNetworkConnectionPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

const int channelCount
 
QHttpNetworkConnectionChannelchannels
 
bool encrypt
 
QList< HttpMessagePairhighPriorityQueue
 
QString hostName
 
QList< HttpMessagePairlowPriorityQueue
 
QNetworkProxy networkProxy
 
QSharedPointer< QNetworkSessionnetworkSession
 
quint16 port
 
ConnectionState state
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Static Public Variables

static const int defaultChannelCount = 6
 
static const int defaultPipelineLength = 3
 
static const int defaultRePipelineLength = 2
 

Friends

class QHttpNetworkConnectionChannel
 

Additional Inherited Members

- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Detailed Description

Definition at line 142 of file qhttpnetworkconnection_p.h.

Enumerations

◆ anonymous enum

anonymous enum
Enumerator
ChunkSize 

Definition at line 164 of file qhttpnetworkconnection_p.h.

◆ ConnectionState

Enumerator
RunningState 
PausedState 

Definition at line 150 of file qhttpnetworkconnection_p.h.

Constructors and Destructors

◆ QHttpNetworkConnectionPrivate() [1/2]

QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate ( const QString hostName,
quint16  port,
bool  encrypt 
)

◆ QHttpNetworkConnectionPrivate() [2/2]

QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate ( quint16  channelCount,
const QString hostName,
quint16  port,
bool  encrypt 
)

◆ ~QHttpNetworkConnectionPrivate()

QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate ( )

Definition at line 108 of file qhttpnetworkconnection.cpp.

109 {
110  for (int i = 0; i < channelCount; ++i) {
111  if (channels[i].socket) {
112  channels[i].socket->close();
113  delete channels[i].socket;
114  }
115  }
116  delete []channels;
117 }
QHttpNetworkConnectionChannel * channels
void close()
Closes the I/O device for the socket, disconnects the socket&#39;s connection with the host...

Functions

◆ _q_startNextRequest()

void QHttpNetworkConnectionPrivate::_q_startNextRequest ( )

Definition at line 806 of file qhttpnetworkconnection.cpp.

Referenced by queueRequest().

807 {
808  // If the QHttpNetworkConnection is currently paused then bail out immediately
809  if (state == PausedState)
810  return;
811 
812  //resend the necessary ones.
813  for (int i = 0; i < channelCount; ++i) {
814  if (channels[i].resendCurrent && (channels[i].state != QHttpNetworkConnectionChannel::ClosingState)) {
815  channels[i].resendCurrent = false;
817 
818  // if this is not possible, error will be emitted and connection terminated
819  if (!channels[i].resetUploadData())
820  continue;
821  channels[i].sendRequest();
822  }
823  }
824 
825  // dequeue new ones
826 
827  // return fast if there is nothing to do
828  if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
829  return;
830  // try to get a free AND connected socket
831  for (int i = 0; i < channelCount; ++i) {
832  if (!channels[i].reply && !channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) {
833  if (dequeueRequest(channels[i].socket))
834  channels[i].sendRequest();
835  }
836  }
837 
838  // try to push more into all sockets
839  // ### FIXME we should move this to the beginning of the function
840  // as soon as QtWebkit is properly using the pipelining
841  // (e.g. not for XMLHttpRequest or the first page load)
842  // ### FIXME we should also divide the requests more even
843  // on the connected sockets
844  //tryToFillPipeline(socket);
845  // return fast if there is nothing to pipeline
846  if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
847  return;
848  for (int i = 0; i < channelCount; i++)
849  if (channels[i].socket->state() == QAbstractSocket::ConnectedState)
850  fillPipeline(channels[i].socket);
851 
852  // If there is not already any connected channels we need to connect a new one.
853  // We do not pair the channel with the request until we know if it is
854  // connected or not. This is to reuse connected channels before we connect new once.
855  int queuedRequest = highPriorityQueue.count() + lowPriorityQueue.count();
856  for (int i = 0; i < channelCount; ++i) {
857  if (channels[i].socket->state() == QAbstractSocket::ConnectingState)
858  queuedRequest--;
859  if ( queuedRequest <=0 )
860  break;
861  if (!channels[i].reply && !channels[i].isSocketBusy() && (channels[i].socket->state() == QAbstractSocket::UnconnectedState)) {
863  queuedRequest--;
864  }
865  }
866 }
void fillPipeline(QAbstractSocket *socket)
QList< HttpMessagePair > highPriorityQueue
QHttpNetworkConnectionChannel * channels
QList< HttpMessagePair > lowPriorityQueue
bool dequeueRequest(QAbstractSocket *socket)
SocketState state() const
Returns the state of the socket.

◆ copyCredentials()

void QHttpNetworkConnectionPrivate::copyCredentials ( int  fromChannel,
QAuthenticator auth,
bool  isProxy 
)

Definition at line 316 of file qhttpnetworkconnection.cpp.

Referenced by handleAuthenticateChallenge().

317 {
318  Q_ASSERT(auth);
319 
320  // NTLM is a multi phase authentication. Copying credentials between authenticators would mess things up.
321  if (!isProxy && channels[fromChannel].authMethod == QAuthenticatorPrivate::Ntlm)
322  return;
323  if (isProxy && channels[fromChannel].proxyAuthMethod == QAuthenticatorPrivate::Ntlm)
324  return;
325 
326 
327  // select another channel
328  QAuthenticator* otherAuth = 0;
329  for (int i = 0; i < channelCount; ++i) {
330  if (i == fromChannel)
331  continue;
332  if (isProxy)
333  otherAuth = &channels[i].proxyAuthenticator;
334  else
335  otherAuth = &channels[i].authenticator;
336  // if the credentials are different, copy them
337  if (otherAuth->user().compare(auth->user()))
338  otherAuth->setUser(auth->user());
339  if (otherAuth->password().compare(auth->password()))
340  otherAuth->setPassword(auth->password());
341  }
342 }
void setUser(const QString &user)
Sets the user used for authentication.
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QHttpNetworkConnectionChannel * channels
The QAuthenticator class provides an authentication object.
int compare(const QString &s) const
Definition: qstring.cpp:5037
QString user() const
returns the user used for authentication.
void setPassword(const QString &password)
Sets the password used for authentication.
QString password() const
returns the password used for authentication.

◆ createAuthorization()

void QHttpNetworkConnectionPrivate::createAuthorization ( QAbstractSocket socket,
QHttpNetworkRequest request 
)

Definition at line 441 of file qhttpnetworkconnection.cpp.

442 {
443  Q_ASSERT(socket);
444 
445  int i = indexOf(socket);
446 
447  // Send "Authorization" header, but not if it's NTLM and the socket is already authenticated.
448  if (channels[i].authMethod != QAuthenticatorPrivate::None) {
449  if (!(channels[i].authMethod == QAuthenticatorPrivate::Ntlm && channels[i].lastStatus != 401)) {
451  if (priv && priv->method != QAuthenticatorPrivate::None) {
452  QByteArray response = priv->calculateResponse(request.d->methodName(), request.d->uri(false));
453  request.setHeaderField("Authorization", response);
455  }
456  }
457  }
458 
459  // Send "Proxy-Authorization" header, but not if it's NTLM and the socket is already authenticated.
460  if (channels[i].proxyAuthMethod != QAuthenticatorPrivate::None) {
461  if (!(channels[i].proxyAuthMethod == QAuthenticatorPrivate::Ntlm && channels[i].lastStatus != 407)) {
463  if (priv && priv->method != QAuthenticatorPrivate::None) {
464  QByteArray response = priv->calculateResponse(request.d->methodName(), request.d->uri(false));
465  request.setHeaderField("Proxy-Authorization", response);
466  channels[i].proxyCredentialsSent = true;
467  }
468  }
469  }
470 }
QSharedDataPointer< QHttpNetworkRequestPrivate > d
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QHttpNetworkConnectionChannel * channels
static QAuthenticatorPrivate * getPrivate(QAuthenticator &auth)
int indexOf(QAbstractSocket *socket) const
static const QMetaObjectPrivate * priv(const uint *data)
QByteArray calculateResponse(const QByteArray &method, const QByteArray &path)
QByteArray uri(bool throughProxy) const
void setHeaderField(const QByteArray &name, const QByteArray &data)

◆ dequeueRequest()

bool QHttpNetworkConnectionPrivate::dequeueRequest ( QAbstractSocket socket)

Definition at line 525 of file qhttpnetworkconnection.cpp.

Referenced by _q_startNextRequest().

526 {
527  Q_ASSERT(socket);
528 
529  int i = indexOf(socket);
530 
531  if (!highPriorityQueue.isEmpty()) {
532  // remove from queue before sendRequest! else we might pipeline the same request again
533  HttpMessagePair messagePair = highPriorityQueue.takeLast();
534  if (!messagePair.second->d_func()->requestIsPrepared)
535  prepareRequest(messagePair);
536  channels[i].request = messagePair.first;
537  channels[i].reply = messagePair.second;
538  return true;
539  }
540 
541  if (!lowPriorityQueue.isEmpty()) {
542  // remove from queue before sendRequest! else we might pipeline the same request again
543  HttpMessagePair messagePair = lowPriorityQueue.takeLast();
544  if (!messagePair.second->d_func()->requestIsPrepared)
545  prepareRequest(messagePair);
546  channels[i].request = messagePair.first;
547  channels[i].reply = messagePair.second;
548  return true;
549  }
550  return false;
551 }
void prepareRequest(HttpMessagePair &request)
T1 first
Definition: qpair.h:65
T2 second
Definition: qpair.h:66
QList< HttpMessagePair > highPriorityQueue
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QHttpNetworkConnectionChannel * channels
int indexOf(QAbstractSocket *socket) const
QList< HttpMessagePair > lowPriorityQueue

◆ emitProxyAuthenticationRequired()

void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired ( const QHttpNetworkConnectionChannel chan,
const QNetworkProxy proxy,
QAuthenticator auth 
)

Definition at line 1035 of file qhttpnetworkconnection.cpp.

1036 {
1037  // Also pause the connection because socket notifiers may fire while an user
1038  // dialog is displaying
1039  pauseConnection();
1040  emit chan->reply->proxyAuthenticationRequired(proxy, auth);
1041  resumeConnection();
1042  int i = indexOf(chan->socket);
1043  copyCredentials(i, auth, true);
1044 }
int indexOf(QAbstractSocket *socket) const
#define emit
Definition: qobjectdefs.h:76
void copyCredentials(int fromChannel, QAuthenticator *auth, bool isProxy)
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)

◆ emitReplyError()

void QHttpNetworkConnectionPrivate::emitReplyError ( QAbstractSocket socket,
QHttpNetworkReply reply,
QNetworkReply::NetworkError  errorCode 
)

Definition at line 292 of file qhttpnetworkconnection.cpp.

295 {
297  if (socket && reply) {
298  // this error matters only to this reply
299  reply->d_func()->errorString = errorDetail(errorCode, socket);
300  emit reply->finishedWithError(errorCode, reply->d_func()->errorString);
301  int i = indexOf(socket);
302  // remove the corrupt data if any
303  reply->d_func()->eraseData();
304 
305  // Clean the channel
306  channels[i].close();
307  channels[i].reply = 0;
310 
311  // send the next request
312  QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
313  }
314 }
QString errorString() const
QHttpNetworkConnectionChannel * channels
QString errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket, const QString &extraDetail=QString())
#define Q_Q(Class)
Definition: qglobal.h:2483
void finishedWithError(QNetworkReply::NetworkError errorCode, const QString &detail=QString())
int indexOf(QAbstractSocket *socket) const
#define emit
Definition: qobjectdefs.h:76
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.

◆ errorDetail()

QString QHttpNetworkConnectionPrivate::errorDetail ( QNetworkReply::NetworkError  errorCode,
QAbstractSocket socket,
const QString extraDetail = QString() 
)

Definition at line 685 of file qhttpnetworkconnection.cpp.

Referenced by emitReplyError(), and handleAuthenticateChallenge().

687 {
688  Q_ASSERT(socket);
689 
691  switch (errorCode) {
693  errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(socket->peerName());
694  break;
696  errorString = QCoreApplication::translate("QHttp", "Connection refused");
697  break;
699  errorString = QCoreApplication::translate("QHttp", "Connection closed");
700  break;
702  errorString = QCoreApplication::translate("QAbstractSocket", "Socket operation timed out");
703  break;
705  errorString = QCoreApplication::translate("QHttp", "Proxy requires authentication");
706  break;
708  errorString = QCoreApplication::translate("QHttp", "Host requires authentication");
709  break;
711  errorString = QCoreApplication::translate("QHttp", "Data corrupted");
712  break;
714  errorString = QCoreApplication::translate("QHttp", "Unknown protocol specified");
715  break;
717  errorString = QCoreApplication::translate("QHttp", "SSL handshake failed");
718  break;
719  default:
720  // all other errors are treated as QNetworkReply::UnknownNetworkError
721  errorString = extraDetail;
722  break;
723  }
724  return errorString;
725 }
QString peerName() const
Returns the name of the peer as specified by connectToHost(), or an empty QString if connectToHost() ...
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
Q_GUI_EXPORT QString errorString(EGLint code=eglGetError())
Definition: qegl.cpp:743
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186

◆ expand()

bool QHttpNetworkConnectionPrivate::expand ( QAbstractSocket socket,
QHttpNetworkReply reply,
bool  dataComplete 
)

◆ fillPipeline() [1/2]

void QHttpNetworkConnectionPrivate::fillPipeline ( QAbstractSocket socket)

Definition at line 563 of file qhttpnetworkconnection.cpp.

Referenced by _q_startNextRequest().

564 {
565  // return fast if there is nothing to pipeline
566  if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
567  return;
568 
569  int i = indexOf(socket);
570 
571  // return fast if there was no reply right now processed
572  if (channels[i].reply == 0)
573  return;
574 
575  if (! (defaultPipelineLength - channels[i].alreadyPipelinedRequests.length() >= defaultRePipelineLength)) {
576  return;
577  }
578 
580  return;
581 
582  // the current request that is in must already support pipelining
583  if (!channels[i].request.isPipeliningAllowed())
584  return;
585 
586  // the current request must be a idempotent (right now we only check GET)
587  if (channels[i].request.operation() != QHttpNetworkRequest::Get)
588  return;
589 
590  // check if socket is connected
591  if (socket->state() != QAbstractSocket::ConnectedState)
592  return;
593 
594  // check for resendCurrent
595  if (channels[i].resendCurrent)
596  return;
597 
598  // we do not like authentication stuff
599  // ### make sure to be OK with this in later releases
600  if (!channels[i].authenticator.isNull()
601  && (!channels[i].authenticator.user().isEmpty()
603  return;
604  if (!channels[i].proxyAuthenticator.isNull()
607  return;
608 
609  // must be in ReadingState or WaitingState
612  return;
613 
614  int lengthBefore;
615  while (!highPriorityQueue.isEmpty()) {
616  lengthBefore = channels[i].alreadyPipelinedRequests.length();
618 
619  if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength) {
620  channels[i].pipelineFlush();
621  return;
622  }
623 
624  if (lengthBefore == channels[i].alreadyPipelinedRequests.length())
625  break; // did not process anything, now do the low prio queue
626  }
627 
628  while (!lowPriorityQueue.isEmpty()) {
629  lengthBefore = channels[i].alreadyPipelinedRequests.length();
631 
632  if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength) {
633  channels[i].pipelineFlush();
634  return;
635  }
636 
637  if (lengthBefore == channels[i].alreadyPipelinedRequests.length())
638  break; // did not process anything
639  }
640 
641 
642  channels[i].pipelineFlush();
643 }
void fillPipeline(QAbstractSocket *socket)
QList< HttpMessagePair > highPriorityQueue
QHttpNetworkConnectionChannel * channels
int indexOf(QAbstractSocket *socket) const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QList< HttpMessagePair > lowPriorityQueue
QString user() const
returns the user used for authentication.
QString password() const
returns the password used for authentication.
SocketState state() const
Returns the state of the socket.

◆ fillPipeline() [2/2]

bool QHttpNetworkConnectionPrivate::fillPipeline ( QList< HttpMessagePair > &  queue,
QHttpNetworkConnectionChannel channel 
)

Definition at line 646 of file qhttpnetworkconnection.cpp.

647 {
648  if (queue.isEmpty())
649  return true;
650 
651  for (int i = queue.count() - 1; i >= 0; --i) {
652  HttpMessagePair messagePair = queue.at(i);
653  const QHttpNetworkRequest &request = messagePair.first;
654 
655  // we currently do not support pipelining if HTTP authentication is used
656  if (!request.url().userInfo().isEmpty())
657  continue;
658 
659  // take only GET requests
660  if (request.operation() != QHttpNetworkRequest::Get)
661  continue;
662 
663  if (!request.isPipeliningAllowed())
664  continue;
665 
666  // remove it from the queue
667  queue.takeAt(i);
668  // we modify the queue we iterate over here, but since we return from the function
669  // afterwards this is fine.
670 
671  // actually send it
672  if (!messagePair.second->d_func()->requestIsPrepared)
673  prepareRequest(messagePair);
674  channel.pipelineInto(messagePair);
675 
676  // return false because we processed something and need to process again
677  return false;
678  }
679 
680  // return true, the queue has been processed and not changed
681  return true;
682 }
void prepareRequest(HttpMessagePair &request)
T1 first
Definition: qpair.h:65
T2 second
Definition: qpair.h:66
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QString userInfo() const
Returns the user info of the URL, or an empty string if the user info is undefined.
Definition: qurl.cpp:4631
Operation operation() const
T takeAt(int i)
Removes the item at index position i and returns it.
Definition: qlist.h:484

◆ handleAuthenticateChallenge()

bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge ( QAbstractSocket socket,
QHttpNetworkReply reply,
bool  isProxy,
bool &  resend 
)

Definition at line 346 of file qhttpnetworkconnection.cpp.

348 {
349  Q_ASSERT(socket);
350  Q_ASSERT(reply);
351 
352  resend = false;
353  //create the response header to be used with QAuthenticatorPrivate.
354  QList<QPair<QByteArray, QByteArray> > fields = reply->header();
355 
356  //find out the type of authentication protocol requested.
357  QAuthenticatorPrivate::Method authMethod = reply->d_func()->authenticationMethod(isProxy);
358  if (authMethod != QAuthenticatorPrivate::None) {
359  int i = indexOf(socket);
360  //Use a single authenticator for all domains. ### change later to use domain/realm
361  QAuthenticator* auth = 0;
362  if (isProxy) {
363  auth = &channels[i].proxyAuthenticator;
364  channels[i].proxyAuthMethod = authMethod;
365  } else {
366  auth = &channels[i].authenticator;
367  channels[i].authMethod = authMethod;
368  }
369  //proceed with the authentication.
370  if (auth->isNull())
371  auth->detach();
373  priv->parseHttpResponse(fields, isProxy);
374 
375  if (priv->phase == QAuthenticatorPrivate::Done) {
376  pauseConnection();
377  if (!isProxy) {
378  if (channels[i].authenticationCredentialsSent) {
379  auth->detach();
380  priv = QAuthenticatorPrivate::getPrivate(*auth);
381  priv->hasFailed = true;
384  }
385  emit reply->authenticationRequired(reply->request(), auth);
386 #ifndef QT_NO_NETWORKPROXY
387  } else {
388  if (channels[i].proxyCredentialsSent) {
389  auth->detach();
390  priv = QAuthenticatorPrivate::getPrivate(*auth);
391  priv->hasFailed = true;
393  channels[i].proxyCredentialsSent = false;
394  }
396 #endif
397  }
399 
400  if (priv->phase != QAuthenticatorPrivate::Done) {
401  // send any pending requests
402  copyCredentials(i, auth, isProxy);
403  }
404  } else if (priv->phase == QAuthenticatorPrivate::Start) {
405  // If the url's authenticator has a 'user' set we will end up here (phase is only set to 'Done' by
406  // parseHttpResponse above if 'user' is empty). So if credentials were supplied with the request,
407  // such as in the case of an XMLHttpRequest, this is our only opportunity to cache them.
408  emit reply->cacheCredentials(reply->request(), auth);
409  }
410  // - Changing values in QAuthenticator will reset the 'phase'. Therefore if it is still "Done"
411  // then nothing was filled in by the user or the cache
412  // - If withCredentials has been set to false (e.g. by QtWebKit for a cross-origin XMLHttpRequest) then
413  // we need to bail out if authentication is required.
414  if (priv->phase == QAuthenticatorPrivate::Done || !reply->request().withCredentials()) {
415  // Reset authenticator so the next request on that channel does not get messed up
416  auth = 0;
417  if (isProxy)
419  else
421 
422  // authentication is cancelled, send the current contents to the user.
425  QNetworkReply::NetworkError errorCode =
426  isProxy
429  reply->d_func()->errorString = errorDetail(errorCode, socket);
430  emit reply->finishedWithError(errorCode, reply->d_func()->errorString);
431  // ### at this point the reply could be deleted
432  return true;
433  }
434  //resend the request
435  resend = true;
436  return true;
437  }
438  return false;
439 }
void cacheCredentials(const QHttpNetworkRequest &request, QAuthenticator *authenticator)
QHttpNetworkRequest request() const
QAuthenticatorPrivate::Method authMethod
void parseHttpResponse(const QHttpResponseHeader &, bool isProxy)
QList< QPair< QByteArray, QByteArray > > header() const
NetworkError
Indicates all possible error conditions found during the processing of the request.
Definition: qnetworkreply.h:70
QString errorString() const
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QHttpNetworkConnectionChannel * channels
QString errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket, const QString &extraDetail=QString())
static QAuthenticatorPrivate * getPrivate(QAuthenticator &auth)
void authenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *authenticator)
void finishedWithError(QNetworkReply::NetworkError errorCode, const QString &detail=QString())
int indexOf(QAbstractSocket *socket) const
#define emit
Definition: qobjectdefs.h:76
The QAuthenticator class provides an authentication object.
void copyCredentials(int fromChannel, QAuthenticator *auth, bool isProxy)
bool isNull() const
Returns true if the authenticator is null.
static const QMetaObjectPrivate * priv(const uint *data)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
QAuthenticatorPrivate::Method proxyAuthMethod
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)

◆ indexOf()

int QHttpNetworkConnectionPrivate::indexOf ( QAbstractSocket socket) const

Definition at line 168 of file qhttpnetworkconnection.cpp.

Referenced by createAuthorization(), dequeueRequest(), emitReplyError(), fillPipeline(), and handleAuthenticateChallenge().

169 {
170  for (int i = 0; i < channelCount; ++i)
171  if (channels[i].socket == socket)
172  return i;
173 
174  qFatal("Called with unknown socket object.");
175  return 0;
176 }
QHttpNetworkConnectionChannel * channels
Q_CORE_EXPORT void qFatal(const char *,...)

◆ init()

void QHttpNetworkConnectionPrivate::init ( )

Definition at line 119 of file qhttpnetworkconnection.cpp.

120 {
121  for (int i = 0; i < channelCount; i++) {
122  channels[i].setConnection(this->q_func());
123  channels[i].ssl = encrypt;
124 #ifndef QT_NO_BEARERMANAGEMENT
125  //push session down to channels
127 #endif
128  channels[i].init();
129  }
130 }
QHttpNetworkConnectionChannel * channels
QSharedPointer< QNetworkSession > networkSession
QSharedPointer< QNetworkSession > networkSession
void setConnection(QHttpNetworkConnection *c)

◆ pauseConnection()

void QHttpNetworkConnectionPrivate::pauseConnection ( )

Definition at line 132 of file qhttpnetworkconnection.cpp.

Referenced by handleAuthenticateChallenge().

133 {
134  state = PausedState;
135 
136  // Disable all socket notifiers
137  for (int i = 0; i < channelCount; i++) {
138 #ifndef QT_NO_OPENSSL
139  if (encrypt)
140  QSslSocketPrivate::pauseSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
141  else
142 #endif
144  }
145 }
QHttpNetworkConnectionChannel * channels
static void pauseSocketNotifiers(QAbstractSocket *)
static void pauseSocketNotifiers(QSslSocket *)

◆ predictNextRequest()

QHttpNetworkRequest QHttpNetworkConnectionPrivate::predictNextRequest ( )

Definition at line 553 of file qhttpnetworkconnection.cpp.

554 {
555  if (!highPriorityQueue.isEmpty())
556  return highPriorityQueue.last().first;
557  if (!lowPriorityQueue.isEmpty())
558  return lowPriorityQueue.last().first;
559  return QHttpNetworkRequest();
560 }
QList< HttpMessagePair > highPriorityQueue
QList< HttpMessagePair > lowPriorityQueue

◆ prepareRequest()

void QHttpNetworkConnectionPrivate::prepareRequest ( HttpMessagePair request)

Definition at line 188 of file qhttpnetworkconnection.cpp.

Referenced by dequeueRequest(), and fillPipeline().

189 {
190  QHttpNetworkRequest &request = messagePair.first;
191  QHttpNetworkReply *reply = messagePair.second;
192 
193  // add missing fields for the request
194  QByteArray value;
195  // check if Content-Length is provided
196  QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice();
197  if (uploadByteDevice) {
198  if (request.contentLength() != -1 && uploadByteDevice->size() != -1) {
199  // both values known, take the smaller one.
200  request.setContentLength(qMin(uploadByteDevice->size(), request.contentLength()));
201  } else if (request.contentLength() == -1 && uploadByteDevice->size() != -1) {
202  // content length not supplied by user, but the upload device knows it
203  request.setContentLength(uploadByteDevice->size());
204  } else if (request.contentLength() != -1 && uploadByteDevice->size() == -1) {
205  // everything OK, the user supplied us the contentLength
206  } else if (request.contentLength() == -1 && uploadByteDevice->size() == -1) {
207  qFatal("QHttpNetworkConnectionPrivate: Neither content-length nor upload device size were given");
208  }
209  }
210  // set the Connection/Proxy-Connection: Keep-Alive headers
211 #ifndef QT_NO_NETWORKPROXY
213  value = request.headerField("proxy-connection");
214  if (value.isEmpty())
215  request.setHeaderField("Proxy-Connection", "Keep-Alive");
216  } else {
217 #endif
218  value = request.headerField("connection");
219  if (value.isEmpty())
220  request.setHeaderField("Connection", "Keep-Alive");
221 #ifndef QT_NO_NETWORKPROXY
222  }
223 #endif
224 
225  // If the request had a accept-encoding set, we better not mess
226  // with it. If it was not set, we announce that we understand gzip
227  // and remember this fact in request.d->autoDecompress so that
228  // we can later decompress the HTTP reply if it has such an
229  // encoding.
230  value = request.headerField("accept-encoding");
231  if (value.isEmpty()) {
232 #ifndef QT_NO_COMPRESS
233  request.setHeaderField("Accept-Encoding", "gzip");
234  request.d->autoDecompress = true;
235 #else
236  // if zlib is not available set this to false always
237  request.d->autoDecompress = false;
238 #endif
239  }
240 
241  // some websites mandate an accept-language header and fail
242  // if it is not sent. This is a problem with the website and
243  // not with us, but we work around this by setting
244  // one always.
245  value = request.headerField("accept-language");
246  if (value.isEmpty()) {
248  QString acceptLanguage;
249  if (systemLocale == QLatin1String("C"))
250  acceptLanguage = QString::fromAscii("en,*");
251  else if (systemLocale.startsWith(QLatin1String("en-")))
252  acceptLanguage = QString::fromAscii("%1,*").arg(systemLocale);
253  else
254  acceptLanguage = QString::fromAscii("%1,en,*").arg(systemLocale);
255  request.setHeaderField("Accept-Language", acceptLanguage.toAscii());
256  }
257 
258  // set the User Agent
259  value = request.headerField("user-agent");
260  if (value.isEmpty())
261  request.setHeaderField("User-Agent", "Mozilla/5.0");
262  // set the host
263  value = request.headerField("host");
264  if (value.isEmpty()) {
266  QByteArray host;
267  if(add.setAddress(hostName)) {
269  host = "[" + hostName.toAscii() + "]";//format the ipv6 in the standard way
270  } else {
271  host = QUrl::toAce(hostName);
272  }
273  } else {
274  host = QUrl::toAce(hostName);
275  }
276 
277  int port = request.url().port();
278  if (port != -1) {
279  host += ':';
280  host += QByteArray::number(port);
281  }
282 
283  request.setHeaderField("Host", host);
284  }
285 
286  reply->d_func()->requestIsPrepared = true;
287 }
QNetworkProxy::ProxyType type() const
Returns the proxy type for this instance.
QSharedDataPointer< QHttpNetworkRequestPrivate > d
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
static const QSystemLocale * systemLocale()
Definition: qlocale.cpp:471
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
#define add(aName)
QString & replace(int i, int len, QChar after)
Definition: qstring.cpp:2005
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
T1 first
Definition: qpair.h:65
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QString name() const
Returns the language and country of this locale as a string of the form "language_country", where language is a lowercase, two-letter ISO 639 language code, and country is an uppercase, two- or three-letter ISO 3166 country code.
Definition: qlocale.cpp:963
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QLocale system()
Returns a QLocale object initialized to the system locale.
Definition: qlocale.cpp:1917
int port() const
Returns the port of the URL, or -1 if the port is unspecified.
Definition: qurl.cpp:4916
QNonContiguousByteDevice * uploadByteDevice() const
static QByteArray toAce(const QString &)
Returns the ASCII Compatible Encoding of the given domain name domain.
Definition: qurl.cpp:6158
QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue=QByteArray()) const
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
Q_CORE_EXPORT void qFatal(const char *,...)
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
QAbstractSocket::NetworkLayerProtocol protocol() const
Returns the network layer protocol of the host address.
void setContentLength(qint64 length)
void setAddress(quint32 ip4Addr)
Set the IPv4 address specified by ip4Addr.
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4014
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
A QNonContiguousByteDevice is a representation of a file, array or buffer that allows access with a r...
void setHeaderField(const QByteArray &name, const QByteArray &data)
The QHostAddress class provides an IP address.
Definition: qhostaddress.h:70
virtual qint64 size()=0
Returns the size of the complete device or -1 if unknown.
static QChar fromAscii(char c)
Converts the ASCII character c to its equivalent QChar.
Definition: qchar.cpp:1521
static QByteArray number(int, int base=10)
Returns a byte array containing the string equivalent of the number n to base base (10 by default)...

◆ queueRequest()

QHttpNetworkReply * QHttpNetworkConnectionPrivate::queueRequest ( const QHttpNetworkRequest request)

Definition at line 472 of file qhttpnetworkconnection.cpp.

473 {
475 
476  // The reply component of the pair is created initially.
477  QHttpNetworkReply *reply = new QHttpNetworkReply(request.url());
478  reply->setRequest(request);
479  reply->d_func()->connection = q;
480  reply->d_func()->connectionChannel = &channels[0]; // will have the correct one set later
481  HttpMessagePair pair = qMakePair(request, reply);
482 
483  switch (request.priority()) {
485  highPriorityQueue.prepend(pair);
486  break;
489  lowPriorityQueue.prepend(pair);
490  break;
491  }
492 
493  // this used to be called via invokeMethod and a QueuedConnection
494  // It is the only place _q_startNextRequest is called directly without going
495  // through the event loop using a QueuedConnection.
496  // This is dangerous because of recursion that might occur when emitting
497  // signals as DirectConnection from this code path. Therefore all signal
498  // emissions that can come out from this code path need to
499  // be QueuedConnection.
500  // We are currently trying to fine-tune this.
502 
503 
504  return reply;
505 }
void setRequest(const QHttpNetworkRequest &request)
QList< HttpMessagePair > highPriorityQueue
QHttpNetworkConnectionChannel * channels
#define Q_Q(Class)
Definition: qglobal.h:2483
QList< HttpMessagePair > lowPriorityQueue
QHttpNetworkConnection * connection()
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
Definition: qpair.h:102

◆ readMoreLater()

void QHttpNetworkConnectionPrivate::readMoreLater ( QHttpNetworkReply reply)

Definition at line 869 of file qhttpnetworkconnection.cpp.

870 {
871  for (int i = 0 ; i < channelCount; ++i) {
872  if (channels[i].reply == reply) {
873  // emulate a readyRead() from the socket
875  return;
876  }
877  }
878 }
QHttpNetworkConnectionChannel * channels
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.

◆ removeReply()

void QHttpNetworkConnectionPrivate::removeReply ( QHttpNetworkReply reply)

Definition at line 729 of file qhttpnetworkconnection.cpp.

730 {
732 
733  // check if the reply is currently being processed or it is pipelined in
734  for (int i = 0; i < channelCount; ++i) {
735  // is the reply associated the currently processing of this channel?
736  if (channels[i].reply == reply) {
737  channels[i].reply = 0;
739  channels[i].resendCurrent = false;
740 
741  if (!reply->isFinished() && !channels[i].alreadyPipelinedRequests.isEmpty()) {
742  // the reply had to be prematurely removed, e.g. it was not finished
743  // therefore we have to requeue the already pipelined requests.
745  }
746 
747  // if HTTP mandates we should close
748  // or the reply is not finished yet, e.g. it was aborted
749  // we have to close that connection
750  if (reply->d_func()->isConnectionCloseEnabled() || !reply->isFinished())
751  channels[i].close();
752 
753  QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
754  return;
755  }
756 
757  // is the reply inside the pipeline of this channel already?
758  for (int j = 0; j < channels[i].alreadyPipelinedRequests.length(); j++) {
759  if (channels[i].alreadyPipelinedRequests.at(j).second == reply) {
760  // Remove that HttpMessagePair
761  channels[i].alreadyPipelinedRequests.removeAt(j);
762 
764 
765  // Since some requests had already been pipelined, but we removed
766  // one and re-queued the others
767  // we must force a connection close after the request that is
768  // currently in processing has been finished.
769  if (channels[i].reply)
770  channels[i].reply->d_func()->forceConnectionCloseEnabled = true;
771 
772  QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
773  return;
774  }
775  }
776  }
777  // remove from the high priority queue
778  if (!highPriorityQueue.isEmpty()) {
779  for (int j = highPriorityQueue.count() - 1; j >= 0; --j) {
780  HttpMessagePair messagePair = highPriorityQueue.at(j);
781  if (messagePair.second == reply) {
782  highPriorityQueue.removeAt(j);
783  QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
784  return;
785  }
786  }
787  }
788  // remove from the low priority queue
789  if (!lowPriorityQueue.isEmpty()) {
790  for (int j = lowPriorityQueue.count() - 1; j >= 0; --j) {
791  HttpMessagePair messagePair = lowPriorityQueue.at(j);
792  if (messagePair.second == reply) {
793  lowPriorityQueue.removeAt(j);
794  QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
795  return;
796  }
797  }
798  }
799 }
T2 second
Definition: qpair.h:66
QList< HttpMessagePair > highPriorityQueue
QHttpNetworkConnectionChannel * channels
#define Q_Q(Class)
Definition: qglobal.h:2483
QList< HttpMessagePair > lowPriorityQueue
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.

◆ requeueRequest()

void QHttpNetworkConnectionPrivate::requeueRequest ( const HttpMessagePair pair)

Definition at line 507 of file qhttpnetworkconnection.cpp.

508 {
510 
511  QHttpNetworkRequest request = pair.first;
512  switch (request.priority()) {
514  highPriorityQueue.prepend(pair);
515  break;
518  lowPriorityQueue.prepend(pair);
519  break;
520  }
521 
522  QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
523 }
T1 first
Definition: qpair.h:65
QList< HttpMessagePair > highPriorityQueue
#define Q_Q(Class)
Definition: qglobal.h:2483
QList< HttpMessagePair > lowPriorityQueue
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.

◆ resumeConnection()

void QHttpNetworkConnectionPrivate::resumeConnection ( )

Definition at line 147 of file qhttpnetworkconnection.cpp.

Referenced by handleAuthenticateChallenge().

148 {
150  // Enable all socket notifiers
151  for (int i = 0; i < channelCount; i++) {
152 #ifndef QT_NO_OPENSSL
153  if (encrypt)
154  QSslSocketPrivate::resumeSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
155  else
156 #endif
158 
159  // Resume pending upload if needed
161  QMetaObject::invokeMethod(&channels[i], "_q_uploadDataReadyRead", Qt::QueuedConnection);
162  }
163 
164  // queue _q_startNextRequest
165  QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection);
166 }
static void resumeSocketNotifiers(QSslSocket *)
static void resumeSocketNotifiers(QAbstractSocket *)
QHttpNetworkConnectionChannel * channels
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.

◆ uncompressedBytesAvailable()

qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailable ( const QHttpNetworkReply reply) const

Definition at line 178 of file qhttpnetworkconnection.cpp.

179 {
180  return reply.d_func()->responseData.byteAmount();
181 }

◆ uncompressedBytesAvailableNextBlock()

qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailableNextBlock ( const QHttpNetworkReply reply) const

Definition at line 183 of file qhttpnetworkconnection.cpp.

184 {
185  return reply.d_func()->responseData.sizeNextBlock();
186 }

Friends and Related Functions

◆ QHttpNetworkConnectionChannel

Definition at line 222 of file qhttpnetworkconnection_p.h.

Properties

◆ channelCount

const int QHttpNetworkConnectionPrivate::channelCount

◆ channels

QHttpNetworkConnectionChannel* QHttpNetworkConnectionPrivate::channels

◆ defaultChannelCount

const int QHttpNetworkConnectionPrivate::defaultChannelCount = 6
static

Definition at line 146 of file qhttpnetworkconnection_p.h.

◆ defaultPipelineLength

const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3
static

Definition at line 147 of file qhttpnetworkconnection_p.h.

Referenced by fillPipeline().

◆ defaultRePipelineLength

const int QHttpNetworkConnectionPrivate::defaultRePipelineLength = 2
static

Definition at line 148 of file qhttpnetworkconnection_p.h.

Referenced by fillPipeline().

◆ encrypt

bool QHttpNetworkConnectionPrivate::encrypt

Definition at line 197 of file qhttpnetworkconnection_p.h.

Referenced by init(), pauseConnection(), and resumeConnection().

◆ highPriorityQueue

QList<HttpMessagePair> QHttpNetworkConnectionPrivate::highPriorityQueue

◆ hostName

QString QHttpNetworkConnectionPrivate::hostName

Definition at line 195 of file qhttpnetworkconnection_p.h.

Referenced by prepareRequest().

◆ lowPriorityQueue

QList<HttpMessagePair> QHttpNetworkConnectionPrivate::lowPriorityQueue

◆ networkProxy

QNetworkProxy QHttpNetworkConnectionPrivate::networkProxy

Definition at line 210 of file qhttpnetworkconnection_p.h.

Referenced by handleAuthenticateChallenge(), and prepareRequest().

◆ networkSession

QSharedPointer<QNetworkSession> QHttpNetworkConnectionPrivate::networkSession

Definition at line 219 of file qhttpnetworkconnection_p.h.

Referenced by init().

◆ port

quint16 QHttpNetworkConnectionPrivate::port

Definition at line 196 of file qhttpnetworkconnection_p.h.

Referenced by prepareRequest().

◆ state

ConnectionState QHttpNetworkConnectionPrivate::state

The documentation for this class was generated from the following files: