HTTP internals: consider SSL sockets with pending encryption as usable

We do not decide which socket a HTTP request is sent on until the
socket is actually ready for sending a request (i.e. it is connected
for HTTP requests and encryption is done for HTTPS requests).

When deciding how many sockets we need for the queued requests, we
consider an in-flight socket as free if it is still connecting.
However, we considered a socket that was connected but needed to
complete encryption as busy, and would instead open another socket.
Now, we consider an encrypting socket as in-flight as well.

Change-Id: I93d6743da6fc430d1424c6965e1475865fd97243
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Peter Hartmann 2013-06-13 11:53:35 +02:00 committed by The Qt Project
parent 36d42a0ede
commit 75e9c7d6bc
2 changed files with 6 additions and 1 deletions

View File

@ -929,7 +929,9 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
for (int i = 0; i < channelCount; ++i) {
bool connectChannel = false;
if (channels[i].socket) {
if ((channels[i].socket->state() == QAbstractSocket::ConnectingState) || (channels[i].socket->state() == QAbstractSocket::HostLookupState))
if ((channels[i].socket->state() == QAbstractSocket::ConnectingState)
|| (channels[i].socket->state() == QAbstractSocket::HostLookupState)
|| channels[i].pendingEncrypt) // pendingEncrypt == "EncryptingState"
queuedRequest--;
if ( queuedRequest <=0 )
break;

View File

@ -183,6 +183,9 @@ void QHttpNetworkConnectionChannel::close()
else
state = QHttpNetworkConnectionChannel::ClosingState;
// pendingEncrypt must only be true in between connected and encrypted states
pendingEncrypt = false;
if (socket)
socket->close();
}