252 QHttpNetworkRequest &request = messagePair.first;
253 QHttpNetworkReply *reply = messagePair.second;
259 QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice();
260 if (uploadByteDevice) {
261 const qint64 contentLength = request.contentLength();
262 const qint64 uploadDeviceSize = uploadByteDevice->size();
263 if (contentLength != -1 && uploadDeviceSize != -1) {
265 if (uploadDeviceSize < contentLength)
266 request.setContentLength(uploadDeviceSize);
267 }
else if (contentLength == -1 && uploadDeviceSize != -1) {
269 request.setContentLength(uploadDeviceSize);
270 }
else if (contentLength != -1 && uploadDeviceSize == -1) {
272 }
else if (Q_UNLIKELY(contentLength == -1 && uploadDeviceSize == -1)) {
273 qFatal(
"QHttpNetworkConnectionPrivate: Neither content-length nor upload device size were given");
278#ifndef QT_NO_NETWORKPROXY
279 if (networkProxy.type() == QNetworkProxy::HttpCachingProxy) {
280 value = request.headerField(
"proxy-connection");
282 request.setHeaderField(
"Proxy-Connection",
"Keep-Alive");
285 value = request.headerField(
"connection");
287 request.setHeaderField(
"Connection",
"Keep-Alive");
288#ifndef QT_NO_NETWORKPROXY
297 value = request.headerField(
"accept-encoding");
298 if (value.isEmpty()) {
299#ifndef QT_NO_COMPRESS
300 const static QByteArray acceptedEncoding = QDecompressHelper::acceptedEncoding().join(
", ");
301 request.setHeaderField(
"Accept-Encoding", acceptedEncoding);
302 request.d->autoDecompress =
true;
305 request.d->autoDecompress =
false;
313 value = request.headerField(
"accept-language");
315 request.setHeaderField(
"Accept-Language", makeAcceptLanguage());
318 value = request.headerField(
"user-agent");
320 request.setHeaderField(
"User-Agent",
"Mozilla/5.0");
322 value = request.headerField(
"host");
327 request.prependHeaderField(
"Host", request.url().host().toLocal8Bit());
328 }
else if (value.isEmpty()) {
331 if (add.setAddress(hostName)) {
332 if (add.protocol() == QAbstractSocket::IPv6Protocol)
333 host = (u'[' + removeZoneId(hostName) + u']').toLatin1();
335 host = hostName.toLatin1();
338 host = QUrl::toAce(hostName);
341 int port = request.url().port();
344 host += QByteArray::number(port);
347 request.prependHeaderField(
"Host", host);
350 reply->d_func()->requestIsPrepared =
true;
357 QHttpNetworkReply *reply,
358 QNetworkReply::NetworkError errorCode)
360 Q_Q(QHttpNetworkConnection);
368 reply->d_func()->errorString = errorDetail(errorCode, socket);
369 emit reply->finishedWithError(errorCode, reply->d_func()->errorString);
371 reply->d_func()->eraseData();
375 channels[i].reply =
nullptr;
376 if (channels[i].protocolHandler)
377 channels[i].protocolHandler->setReply(
nullptr);
378 channels[i].request = QHttpNetworkRequest();
380 channels[i].requeueCurrentlyPipelinedRequests();
383 QMetaObject::invokeMethod(q,
"_q_startNextRequest", Qt::QueuedConnection);
393 if (fromChannel >= 0) {
394 QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*auth);
396 && (priv->method == QAuthenticatorPrivate::Ntlm
397 || priv->method == QAuthenticatorPrivate::Negotiate)) {
403 QAuthenticator* otherAuth =
nullptr;
405 if (i == fromChannel)
408 otherAuth = &channels[i].proxyAuthenticator;
410 otherAuth = &channels[i].authenticator;
412 if (otherAuth->user().compare(auth->user()))
413 otherAuth->setUser(auth->user());
414 if (otherAuth->password().compare(auth->password()))
415 otherAuth->setPassword(auth->password());
422 bool isProxy,
bool &resend)
429 const auto headers = reply->header();
432 const QByteArray header = isProxy ?
"proxy-authenticate" :
"www-authenticate";
433 const QByteArrayList &authenticationMethods = reply->d_func()->headerFieldValues(header);
434 const bool isSupported = std::any_of(authenticationMethods.begin(), authenticationMethods.end(),
435 QAuthenticatorPrivate::isMethodSupported);
437 int i = indexOf(socket);
439 QAuthenticator *auth = isProxy ? &channels[i].proxyAuthenticator
440 : &channels[i].authenticator;
444 QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*auth);
445 priv->parseHttpResponse(headers, isProxy, reply->url().host());
447 if (priv->method == QAuthenticatorPrivate::None)
450 if (priv->phase == QAuthenticatorPrivate::Done ||
451 (priv->phase == QAuthenticatorPrivate::Start
452 && (priv->method == QAuthenticatorPrivate::Ntlm
453 || priv->method == QAuthenticatorPrivate::Negotiate))) {
454 if (priv->phase == QAuthenticatorPrivate::Start)
455 priv->phase = QAuthenticatorPrivate::Phase1;
459 if (channels[i].authenticationCredentialsSent) {
461 priv = QAuthenticatorPrivate::getPrivate(*auth);
462 priv->hasFailed =
true;
463 priv->phase = QAuthenticatorPrivate::Done;
464 channels[i].authenticationCredentialsSent =
false;
466 emit reply->authenticationRequired(reply->request(), auth);
467#ifndef QT_NO_NETWORKPROXY
469 if (channels[i].proxyCredentialsSent) {
471 priv = QAuthenticatorPrivate::getPrivate(*auth);
472 priv->hasFailed =
true;
473 priv->phase = QAuthenticatorPrivate::Done;
474 channels[i].proxyCredentialsSent =
false;
476 emit reply->proxyAuthenticationRequired(networkProxy, auth);
481 if (priv->phase != QAuthenticatorPrivate::Done) {
483 copyCredentials(i, auth, isProxy);
485 }
else if (priv->phase == QAuthenticatorPrivate::Start) {
489 emit reply->cacheCredentials(reply->request(), auth);
495 if (priv->phase == QAuthenticatorPrivate::Done || !reply->request().withCredentials()) {
499 channels[i].proxyAuthenticator = QAuthenticator();
501 channels[i].authenticator = QAuthenticator();
504 emit reply->headerChanged();
505 emit reply->readyRead();
506 QNetworkReply::NetworkError errorCode =
508 ? QNetworkReply::ProxyAuthenticationRequiredError
509 : QNetworkReply::AuthenticationRequiredError;
510 reply->d_func()->errorString = errorDetail(errorCode, socket);
511 emit reply->finishedWithError(errorCode, reply->d_func()->errorString);
537 if (!reply->request().isFollowRedirects())
538 return {{}, QNetworkReply::NoError};
541 const QHttpHeaders fields = reply->header();
542 if (
const auto h = fields.values(QHttpHeaders::WellKnownHeader::Location); !h.empty()) {
543 redirectUrl = QUrl::fromEncoded(h.first());
547 if (!redirectUrl.isValid())
548 return {{}, QNetworkReply::ProtocolUnknownError};
551 if (reply->request().redirectCount() <= 0)
552 return {{}, QNetworkReply::TooManyRedirectsError};
555 if (redirectUrl.isRelative())
556 redirectUrl = reply->request().url().resolved(redirectUrl);
559 const QUrl priorUrl(reply->request().url());
560 const QString targetUrlScheme = redirectUrl.scheme();
561 if (targetUrlScheme ==
"http"_L1 || targetUrlScheme ==
"https"_L1
562 || targetUrlScheme.startsWith(
"unix"_L1)) {
563 switch (reply->request().redirectPolicy()) {
564 case QNetworkRequest::NoLessSafeRedirectPolicy:
571 case QNetworkRequest::SameOriginRedirectPolicy:
572 if (priorUrl.host() != redirectUrl.host()
573 || priorUrl.scheme() != targetUrlScheme
574 || priorUrl.port() != redirectUrl.port()) {
575 return {{}, QNetworkReply::InsecureRedirectError};
578 case QNetworkRequest::UserVerifiedRedirectPolicy:
581 Q_ASSERT(!
"Unexpected redirect policy");
584 return {{}, QNetworkReply::ProtocolUnknownError};
586 return {std::move(redirectUrl), QNetworkReply::NoError};
595 QAuthenticator *authenticator = &channel.authenticator;
596 QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*authenticator);
598 if (priv && priv->method != QAuthenticatorPrivate::None) {
599 const bool ntlmNego = priv->method == QAuthenticatorPrivate::Ntlm
600 || priv->method == QAuthenticatorPrivate::Negotiate;
602 const bool ntlmNegoOk = ntlmNego && authNeeded
603 && (priv->phase != QAuthenticatorPrivate::Done
604 || !channel.authenticationCredentialsSent);
606 !ntlmNego && (authNeeded || request.headerField(
"Authorization").isEmpty());
607 if (ntlmNegoOk || otherOk) {
608 QByteArray response = priv->calculateResponse(request.methodName(), request.uri(
false),
609 request.url().host());
610 request.setHeaderField(
"Authorization", response);
615#if QT_CONFIG(networkproxy)
616 authenticator = &channel.proxyAuthenticator;
617 priv = QAuthenticatorPrivate::getPrivate(*authenticator);
619 if (priv && priv->method != QAuthenticatorPrivate::None) {
620 const bool ntlmNego = priv->method == QAuthenticatorPrivate::Ntlm
621 || priv->method == QAuthenticatorPrivate::Negotiate;
622 const bool proxyAuthNeeded = channel.lastStatus == 407;
623 const bool ntlmNegoOk = ntlmNego && proxyAuthNeeded
624 && (priv->phase != QAuthenticatorPrivate::Done || !channel.proxyCredentialsSent);
625 const bool otherOk = !ntlmNego;
626 if (ntlmNegoOk || otherOk) {
627 QByteArray response = priv->calculateResponse(request.methodName(), request.uri(
false),
628 networkProxy.hostName());
629 request.setHeaderField(
"Proxy-Authorization", response);
630 channel.proxyCredentialsSent =
true;
638 Q_Q(QHttpNetworkConnection);
641 QHttpNetworkReply *reply =
new QHttpNetworkReply(request.url());
642 reply->setRequest(request);
643 reply->d_func()->connection = q;
644 reply->d_func()->connectionChannel = &channels[0];
647 if (request.isPreConnect())
650 if (connectionType == QHttpNetworkConnection::ConnectionTypeHTTP
651 || (!encrypt && connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2 && !channels[0].switchedToHttp2)) {
652 switch (request.priority()) {
653 case QHttpNetworkRequest::HighPriority:
654 highPriorityQueue.prepend(pair);
656 case QHttpNetworkRequest::NormalPriority:
657 case QHttpNetworkRequest::LowPriority:
658 lowPriorityQueue.prepend(pair);
663 if (!pair.second->d_func()->requestIsPrepared)
665 channels[0].h2RequestsToSend.insert(request.priority(), pair);
690 for (
auto &pair : highPriorityQueue) {
691 if (!pair.second->d_func()->requestIsPrepared)
692 prepareRequest(pair);
693 channels[0].h2RequestsToSend.insert(QHttpNetworkRequest::HighPriority, pair);
696 highPriorityQueue.clear();
698 for (
auto &pair : lowPriorityQueue) {
699 if (!pair.second->d_func()->requestIsPrepared)
700 prepareRequest(pair);
701 channels[0].h2RequestsToSend.insert(pair.first.priority(), pair);
704 lowPriorityQueue.clear();
782 if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
785 int i = indexOf(socket);
788 if (channels[i].reply ==
nullptr)
791 if (! (defaultPipelineLength - channels[i].alreadyPipelinedRequests.size() >= defaultRePipelineLength)) {
795 if (channels[i].pipeliningSupported != QHttpNetworkConnectionChannel::PipeliningProbablySupported)
799 if (!channels[i].request.isPipeliningAllowed())
803 if (channels[i].request.operation() != QHttpNetworkRequest::Get)
807 if (QSocketAbstraction::socketState(socket) != QAbstractSocket::ConnectedState)
811 if (channels[i].resendCurrent)
816 if (!channels[i].authenticator.isNull()
817 && (!channels[i].authenticator.user().isEmpty()
818 || !channels[i].authenticator.password().isEmpty()))
820 if (!channels[i].proxyAuthenticator.isNull()
821 && (!channels[i].proxyAuthenticator.user().isEmpty()
822 || !channels[i].proxyAuthenticator.password().isEmpty()))
826 if (! (channels[i].state == QHttpNetworkConnectionChannel::WaitingState
827 || channels[i].state == QHttpNetworkConnectionChannel::ReadingState))
831 while (!highPriorityQueue.isEmpty()) {
832 lengthBefore = channels[i].alreadyPipelinedRequests.size();
833 fillPipeline(highPriorityQueue, channels[i]);
835 if (channels[i].alreadyPipelinedRequests.size() >= defaultPipelineLength) {
836 channels[i].pipelineFlush();
840 if (lengthBefore == channels[i].alreadyPipelinedRequests.size())
844 while (!lowPriorityQueue.isEmpty()) {
845 lengthBefore = channels[i].alreadyPipelinedRequests.size();
846 fillPipeline(lowPriorityQueue, channels[i]);
848 if (channels[i].alreadyPipelinedRequests.size() >= defaultPipelineLength) {
849 channels[i].pipelineFlush();
853 if (lengthBefore == channels[i].alreadyPipelinedRequests.size())
858 channels[i].pipelineFlush();
905 case QNetworkReply::HostNotFoundError: {
906 const QString peerName = socket ? QSocketAbstraction::socketPeerName(socket) : hostName;
907 errorString = QCoreApplication::translate(
"QHttp",
"Host %1 not found").arg(peerName);
910 case QNetworkReply::ConnectionRefusedError:
911 errorString = QCoreApplication::translate(
"QHttp",
"Connection refused");
913 case QNetworkReply::RemoteHostClosedError:
914 errorString = QCoreApplication::translate(
"QHttp",
"Connection closed");
916 case QNetworkReply::TimeoutError:
917 errorString = QCoreApplication::translate(
"QAbstractSocket",
"Socket operation timed out");
919 case QNetworkReply::ProxyAuthenticationRequiredError:
920 errorString = QCoreApplication::translate(
"QHttp",
"Proxy requires authentication");
922 case QNetworkReply::AuthenticationRequiredError:
923 errorString = QCoreApplication::translate(
"QHttp",
"Host requires authentication");
925 case QNetworkReply::ProtocolFailure:
926 errorString = QCoreApplication::translate(
"QHttp",
"Data corrupted");
928 case QNetworkReply::ProtocolUnknownError:
929 errorString = QCoreApplication::translate(
"QHttp",
"Unknown protocol specified");
931 case QNetworkReply::SslHandshakeFailedError:
932 errorString = QCoreApplication::translate(
"QHttp",
"SSL handshake failed");
934 errorString +=
": "_L1 + socket->errorString();
936 case QNetworkReply::TooManyRedirectsError:
937 errorString = QCoreApplication::translate(
"QHttp",
"Too many redirects");
939 case QNetworkReply::InsecureRedirectError:
940 errorString = QCoreApplication::translate(
"QHttp",
"Insecure redirect");
944 errorString = extraDetail;
954 Q_Q(QHttpNetworkConnection);
959 if (channels[i].reply == reply) {
960 channels[i].reply =
nullptr;
961 if (channels[i].protocolHandler)
962 channels[i].protocolHandler->setReply(
nullptr);
963 channels[i].request = QHttpNetworkRequest();
964 channels[i].resendCurrent =
false;
966 if (!reply->isFinished() && !channels[i].alreadyPipelinedRequests.isEmpty()) {
969 channels[i].requeueCurrentlyPipelinedRequests();
975 if (reply->d_func()->isConnectionCloseEnabled() || !reply->isFinished()) {
976 if (reply->isAborted()) {
983 QMetaObject::invokeMethod(q,
"_q_startNextRequest", Qt::QueuedConnection);
988 for (
int j = 0; j < channels[i].alreadyPipelinedRequests.size(); j++) {
989 if (channels[i].alreadyPipelinedRequests.at(j).second == reply) {
991 channels[i].alreadyPipelinedRequests.removeAt(j);
993 channels[i].requeueCurrentlyPipelinedRequests();
999 if (channels[i].reply)
1000 channels[i].reply->d_func()->forceConnectionCloseEnabled =
true;
1002 QMetaObject::invokeMethod(q,
"_q_startNextRequest", Qt::QueuedConnection);
1008 return pair.second == reply;
1010 auto &seq = channels[i].h2RequestsToSend;
1011 const auto end = seq.cend();
1012 auto it =
std::find_if(seq.cbegin(), end, foundReply);
1015 QMetaObject::invokeMethod(q,
"_q_startNextRequest", Qt::QueuedConnection);
1019 if ((connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2Direct
1020 || channels[i].switchedToHttp2)
1021 && channels[i].protocolHandler) {
1022 if (channels[i].protocolHandler->tryRemoveReply(reply))
1027 if (!highPriorityQueue.isEmpty()) {
1028 for (
int j = highPriorityQueue.size() - 1; j >= 0; --j) {
1030 if (messagePair.second == reply) {
1031 highPriorityQueue.removeAt(j);
1032 QMetaObject::invokeMethod(q,
"_q_startNextRequest", Qt::QueuedConnection);
1038 if (!lowPriorityQueue.isEmpty()) {
1039 for (
int j = lowPriorityQueue.size() - 1; j >= 0; --j) {
1041 if (messagePair.second == reply) {
1042 lowPriorityQueue.removeAt(j);
1043 QMetaObject::invokeMethod(q,
"_q_startNextRequest", Qt::QueuedConnection);
1067 if (channels[i].resendCurrent && (channels[i].state != QHttpNetworkConnectionChannel::ClosingState)) {
1068 if (!channels[i].socket
1069 || QSocketAbstraction::socketState(channels[i].socket) == QAbstractSocket::UnconnectedState) {
1070 if (!channels[i].ensureConnection())
1073 channels[i].resendCurrent =
false;
1076 if (!channels[i].resetUploadData())
1078 channels[i].sendRequest();
1084 switch (connectionType) {
1085 case QHttpNetworkConnection::ConnectionTypeHTTP: {
1087 if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
1092 if (channels[i].socket) {
1093 if (!channels[i].reply && !channels[i].isSocketBusy()
1094 && QSocketAbstraction::socketState(channels[i].socket)
1095 == QAbstractSocket::ConnectedState) {
1096 if (dequeueRequest(channels[i].socket))
1097 channels[i].sendRequest();
1103 case QHttpNetworkConnection::ConnectionTypeHTTP2Direct:
1104 case QHttpNetworkConnection::ConnectionTypeHTTP2: {
1105 if (channels[0].h2RequestsToSend.isEmpty() && !channels[0].reply
1106 && highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty()) {
1110 if (networkLayerState == IPv4)
1111 channels[0].networkLayerPreference = QAbstractSocket::IPv4Protocol;
1112 else if (networkLayerState == IPv6)
1113 channels[0].networkLayerPreference = QAbstractSocket::IPv6Protocol;
1114 channels[0].ensureConnection();
1115 if (
auto *s = channels[0].socket; s
1116 && QSocketAbstraction::socketState(s) == QAbstractSocket::ConnectedState
1117 && !channels[0].pendingEncrypt) {
1118 if (channels[0].h2RequestsToSend.size()) {
1119 channels[0].sendRequest();
1120 }
else if (!channels[0].reply && !channels[0].switchedToHttp2) {
1125 dequeueRequest(channels[0].socket);
1126 channels[0].sendRequest();
1141 if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
1144 if (channels[i].socket
1145 && QSocketAbstraction::socketState(channels[i].socket)
1146 == QAbstractSocket::ConnectedState) {
1147 fillPipeline(channels[i].socket);
1154 int queuedRequests = highPriorityQueue.size() + lowPriorityQueue.size();
1158 int neededOpenChannels = queuedRequests;
1164 if (neededOpenChannels <= 0)
1167 QVarLengthArray<
int> channelsToConnect;
1171 if (!channels[i].socket)
1174 using State = QAbstractSocket::SocketState;
1175 if ((QSocketAbstraction::socketState(channels[i].socket) == State::ConnectingState)
1176 || (QSocketAbstraction::socketState(channels[i].socket) == State::HostLookupState)
1177 || channels[i].pendingEncrypt) {
1178 neededOpenChannels--;
1182 if (!channels[i].reply && !channels[i].isSocketBusy()
1183 && (QSocketAbstraction::socketState(channels[i].socket) == State::UnconnectedState)) {
1184 channelsToConnect.push_back(i);
1185 neededOpenChannels--;
1191 if (channels[i].socket)
1194 channelsToConnect.push_back(i);
1195 neededOpenChannels--;
1198 auto channelToConnectSpan =
QSpan{channelsToConnect};
1199 while (!channelToConnectSpan.isEmpty()) {
1200 const int channel = channelToConnectSpan.front();
1201 channelToConnectSpan = channelToConnectSpan.sliced(1);
1203 if (networkLayerState == IPv4)
1204 channels[channel].networkLayerPreference = QAbstractSocket::IPv4Protocol;
1205 else if (networkLayerState == IPv6)
1206 channels[channel].networkLayerPreference = QAbstractSocket::IPv6Protocol;
1208 channels[channel].ensureConnection();
1235 QString lookupHost = hostName;
1236#ifndef QT_NO_NETWORKPROXY
1237 if (networkProxy.capabilities() & QNetworkProxy::HostNameLookupCapability) {
1238 lookupHost = networkProxy.hostName();
1239 }
else if (channels[0].proxy.capabilities() & QNetworkProxy::HostNameLookupCapability) {
1240 lookupHost = channels[0].proxy.hostName();
1244 if (temp.setAddress(lookupHost)) {
1245 const QAbstractSocket::NetworkLayerProtocol protocol = temp.protocol();
1246 if (protocol == QAbstractSocket::IPv4Protocol) {
1248 QMetaObject::invokeMethod(
this->q_func(),
"_q_startNextRequest", Qt::QueuedConnection);
1250 }
else if (protocol == QAbstractSocket::IPv6Protocol) {
1252 QMetaObject::invokeMethod(
this->q_func(),
"_q_startNextRequest", Qt::QueuedConnection);
1257 bool immediateResultValid =
false;
1258 QHostInfo hostInfo = qt_qhostinfo_lookup(lookupHost,
1260 SLOT(_q_hostLookupFinished(QHostInfo)),
1261 &immediateResultValid,
1263 if (immediateResultValid) {
1274 bool foundAddress =
false;
1278 const auto addresses = info.addresses();
1279 for (
const QHostAddress &address : addresses) {
1280 const QAbstractSocket::NetworkLayerProtocol protocol = address.protocol();
1281 if (protocol == QAbstractSocket::IPv4Protocol) {
1282 if (!foundAddress) {
1283 foundAddress =
true;
1287 }
else if (protocol == QAbstractSocket::IPv6Protocol) {
1288 if (!foundAddress) {
1289 foundAddress =
true;
1300 QMetaObject::invokeMethod(
this->q_func(),
"_q_startNextRequest", Qt::QueuedConnection);
1303 QMetaObject::invokeMethod(
this->q_func(),
"_q_startNextRequest", Qt::QueuedConnection);
1305 auto lookupError = QNetworkReply::HostNotFoundError;
1306#ifndef QT_NO_NETWORKPROXY
1309 auto proxyCapabilities = networkProxy.capabilities() | channels[0].proxy.capabilities();
1310 if (proxyCapabilities & QNetworkProxy::HostNameLookupCapability)
1311 lookupError = QNetworkReply::ProxyNotFoundError;
1313 if (dequeueRequest(channels[0].socket)) {
1314 emitReplyError(channels[0].socket, channels[0].reply, lookupError);
1316 }
else if (connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2
1317 || connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
1318 for (
const HttpMessagePair &h2Pair : std::as_const(channels[0].h2RequestsToSend)) {
1320 QHttpNetworkReply *currentReply = h2Pair.second;
1321 Q_ASSERT(currentReply);
1322 emitReplyError(channels[0].socket, currentReply, lookupError);
1327 qDebug(
"QHttpNetworkConnectionPrivate::_q_hostLookupFinished"
1328 " could not de-queue request, failed to report HostNotFoundError");
1381QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount,
const QString &hostName,
1382 quint16 port,
bool encrypt,
bool isLocalSocket, QObject *parent,
1383 QHttpNetworkConnection::ConnectionType connectionType)
1384 : QObject(*(
new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt, isLocalSocket,
1385 connectionType)), parent)
1387 Q_D(QHttpNetworkConnection);
1431void QHttpNetworkConnection::setCacheProxy(
const QNetworkProxy &networkProxy)
1433 Q_D(QHttpNetworkConnection);
1434 d->networkProxy = networkProxy;
1436 if (!d->networkProxy.user().isEmpty()) {
1437 for (
int i = 0; i < d->channelCount; ++i) {
1438 d->channels[i].proxyAuthenticator.setUser(d->networkProxy.user());
1439 d->channels[i].proxyAuthenticator.setPassword(d->networkProxy.password());
1594 QHttpNetworkReply *reply;
1595 if ((connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2
1596 && (chan->switchedToHttp2 || chan->h2RequestsToSend.size() > 0))
1597 || connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
1601 Q_ASSERT(chan->h2RequestsToSend.size() > 0);
1602 reply = chan->h2RequestsToSend.cbegin().value().second;
1608 emit reply->proxyAuthenticationRequired(proxy, auth);
1610 int i = indexOf(chan->socket);
1611 copyCredentials(i, auth,
true);