qhttpthreaddelegate.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qhttpthreaddelegate.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url)-
9{-
10 QNetworkReply::NetworkError code;-
11-
12 switch (httpStatusCode) {-
13 case 400:-
14 code = QNetworkReply::ProtocolInvalidOperationError;-
15 break;-
16-
17 case 401:-
18 code = QNetworkReply::AuthenticationRequiredError;-
19 break;-
20-
21 case 403:-
22 code = QNetworkReply::ContentOperationNotPermittedError;-
23 break;-
24-
25 case 404:-
26 code = QNetworkReply::ContentNotFoundError;-
27 break;-
28-
29 case 405:-
30 code = QNetworkReply::ContentOperationNotPermittedError;-
31 break;-
32-
33 case 407:-
34 code = QNetworkReply::ProxyAuthenticationRequiredError;-
35 break;-
36-
37 case 409:-
38 code = QNetworkReply::ContentConflictError;-
39 break;-
40-
41 case 410:-
42 code = QNetworkReply::ContentGoneError;-
43 break;-
44-
45 case 418:-
46 code = QNetworkReply::ProtocolInvalidOperationError;-
47 break;-
48-
49 case 500:-
50 code = QNetworkReply::InternalServerError;-
51 break;-
52-
53 case 501:-
54 code = QNetworkReply::OperationNotImplementedError;-
55 break;-
56-
57 case 503:-
58 code = QNetworkReply::ServiceUnavailableError;-
59 break;-
60-
61 default:-
62 if (httpStatusCode > 500) {-
63-
64 code = QNetworkReply::UnknownServerError;-
65 } else if (httpStatusCode >= 400) {-
66-
67 code = QNetworkReply::UnknownContentError;-
68 } else {-
69 QMessageLogger(__FILE__, 111117, __PRETTY_FUNCTION__).warning("QNetworkAccess: got HTTP status code %d which is not expected from url: \"%s\"",-
70 httpStatusCode, QString(url.toString()).toLocal8Bit().constData());-
71 code = QNetworkReply::ProtocolFailure;-
72 }-
73 }-
74-
75 return code;-
76}-
77-
78-
79static QByteArray makeCacheKey(QUrl &url, QNetworkProxy *proxy)-
80{-
81 QString result;-
82 QUrl copy = url;-
83 QString scheme = copy.scheme();-
84 bool isEncrypted = scheme == QLatin1String("https");-
85 copy.setPort(copy.port(isEncrypted ? 443 : 80));-
86 if (scheme == QLatin1String("preconnect-http")) {-
87 copy.setScheme(QLatin1String("http"));-
88 } else if (scheme == QLatin1String("preconnect-https")) {-
89 copy.setScheme(QLatin1String("https"));-
90 }-
91 result = copy.toString(QUrl::RemoveUserInfo | QUrl::RemovePath |-
92 QUrl::RemoveQuery | QUrl::RemoveFragment | QUrl::FullyEncoded);-
93-
94-
95 if (proxy && proxy->type() != QNetworkProxy::NoProxy) {-
96 QUrl key;-
97-
98 switch (proxy->type()) {-
99 case QNetworkProxy::Socks5Proxy:-
100 key.setScheme(QLatin1String("proxy-socks5"));-
101 break;-
102-
103 case QNetworkProxy::HttpProxy:-
104 case QNetworkProxy::HttpCachingProxy:-
105 key.setScheme(QLatin1String("proxy-http"));-
106 break;-
107-
108 default:-
109 break;-
110 }-
111-
112 if (!key.scheme().isEmpty()) {-
113 key.setUserName(proxy->user());-
114 key.setHost(proxy->hostName());-
115 key.setPort(proxy->port());-
116 key.setQuery(result);-
117 result = key.toString(QUrl::FullyEncoded);-
118 }-
119 }-
120-
121-
122-
123-
124 return "http-connection:" + result.toLatin1();-
125}-
126-
127class QNetworkAccessCachedHttpConnection: public QHttpNetworkConnection,-
128 public QNetworkAccessCache::CacheableObject-
129{-
130-
131public:-
132-
133-
134-
135-
136-
137 QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt,-
138 QHttpNetworkConnection::ConnectionType connectionType,-
139 QSharedPointer<QNetworkSession> networkSession)-
140 : QHttpNetworkConnection(hostName, port, encrypt, connectionType, 0,-
141 std::move(networkSession))-
142-
143 {-
144 setExpires(true);-
145 setShareable(true);-
146 }-
147-
148 virtual void dispose() override-
149 {-
150-
151-
152-
153 delete this;-
154 }-
155};-
156-
157-
158QThreadStorage<QNetworkAccessCache *> QHttpThreadDelegate::connections;-
159-
160-
161QHttpThreadDelegate::~QHttpThreadDelegate()-
162{-
163-
164 if (httpReply) {-
165 delete httpReply;-
166 }-
167-
168-
169-
170 if (connections.hasLocalData() && !cacheKey.isEmpty()) {-
171 connections.localData()->releaseEntry(cacheKey);-
172 }-
173}-
174-
175-
176QHttpThreadDelegate::QHttpThreadDelegate(QObject *parent) :-
177 QObject(parent)-
178 , ssl(false)-
179 , downloadBufferMaximumSize(0)-
180 , readBufferMaxSize(0)-
181 , bytesEmitted(0)-
182 , pendingDownloadData(0)()-
183 , pendingDownloadProgress(0)()-
184 , synchronous(false)-
185 , incomingStatusCode(0)-
186 , isPipeliningUsed(false)-
187 , isSpdyUsed(false)-
188 , incomingContentLength(-1)-
189 , incomingErrorCode(QNetworkReply::NoError)-
190 , downloadBuffer(0)()-
191 , httpConnection(0)-
192 , httpReply(0)-
193 , synchronousRequestLoop(0)-
194{-
195}
executed 869 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
869
196-
197-
198void QHttpThreadDelegate::startRequestSynchronously()-
199{-
200-
201-
202-
203 synchronous = true;-
204-
205 QEventLoop synchronousRequestLoop;-
206 this->synchronousRequestLoop = &synchronousRequestLoop;-
207-
208-
209 QTimer::singleShot(30*1000, this, qFlagLocation("1""abortRequest()" "\0" __FILE__ ":" "251""257"));-
210-
211 QMetaObject::invokeMethod(this, "startRequest", Qt::QueuedConnection);-
212 synchronousRequestLoop.exec();-
213-
214 connections.localData()->releaseEntry(cacheKey);-
215 connections.setLocalData(0);-
216-
217-
218-
219-
220}-
221-
222-
223-
224void QHttpThreadDelegate::startRequest()-
225{-
226-
227-
228-
229-
230-
231 if (!connections.hasLocalData()) {-
232 connections.setLocalData(new QNetworkAccessCache());-
233 }-
234-
235-
236 QUrl urlCopy = httpRequest.url();-
237 urlCopy.setPort(urlCopy.port(ssl ? 443 : 80));-
238-
239 QHttpNetworkConnection::ConnectionType connectionType-
240 = QHttpNetworkConnection::ConnectionTypeHTTP;-
241-
242 if (httpRequest.isSPDYAllowed() && ssl) {-
243 connectionType = QHttpNetworkConnection::ConnectionTypeSPDY;-
244 urlCopy.setScheme(([]() -> QString { enum { Size = sizeof(u"" "spdy")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "spdy" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()));-
245 QList<QByteArray> nextProtocols;-
246 nextProtocols << QSslConfiguration::NextProtocolSpdy3_0-
247 << QSslConfiguration::NextProtocolHttp1_1;-
248 incomingSslConfiguration.setAllowedNextProtocols(nextProtocols);-
249 }-
250-
251-
252-
253 if (transparentProxy.type() != QNetworkProxy::NoProxy)-
254 cacheKey = makeCacheKey(urlCopy, &transparentProxy);-
255 else if (cacheProxy.type() != QNetworkProxy::NoProxy)-
256 cacheKey = makeCacheKey(urlCopy, &cacheProxy);-
257 else-
258-
259 cacheKey = makeCacheKey(urlCopy, 0);-
260-
261-
262-
263 httpConnection = static_cast<QNetworkAccessCachedHttpConnection *>(connections.localData()->requestEntryNow(cacheKey));-
264 if (httpConnection == 0) {-
265-
266-
267-
268-
269-
270-
271 httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl,-
272 connectionType,-
273 networkSession);-
274-
275-
276-
277 if (ssl && incomingSslConfiguration != QSslConfiguration::defaultConfiguration()) {-
278 httpConnection->setSslConfiguration(incomingSslConfiguration);-
279 }-
280-
281-
282-
283 httpConnection->setTransparentProxy(transparentProxy);-
284 httpConnection->setCacheProxy(cacheProxy);-
285-
286-
287-
288 connections.localData()->addEntry(cacheKey, httpConnection);-
289 } else {-
290 if (httpRequest.withCredentials()) {-
291 QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedCredentials(httpRequest.url(), 0);-
292 if (!credential.user.isEmpty() && !credential.password.isEmpty()) {-
293 QAuthenticator auth;-
294 auth.setUser(credential.user);-
295 auth.setPassword(credential.password);-
296 httpConnection->d_func()->copyCredentials(-1, &auth, false);-
297 }-
298 }-
299 }-
300-
301-
302-
303 httpReply = httpConnection->sendRequest(httpRequest);-
304 httpReply->setParent(this);-
305-
306-
307 if (synchronous) {-
308 connect(httpReply,qFlagLocation("2""headerChanged()" "\0" __FILE__ ":" "350""356"), this, qFlagLocation("1""synchronousHeaderChangedSlot()" "\0" __FILE__ ":" "350""356"));-
309 connect(httpReply,qFlagLocation("2""finished()" "\0" __FILE__ ":" "351""357"), this, qFlagLocation("1""synchronousFinishedSlot()" "\0" __FILE__ ":" "351""357"));-
310 connect(httpReply,qFlagLocation("2""finishedWithError(QNetworkReply::NetworkError,QString)" "\0" __FILE__ ":" "352""358"),-
311 this, qFlagLocation("1""synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError,QString)" "\0" __FILE__ ":" "353""359"));-
312-
313 connect(httpReply, qFlagLocation("2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "355""361"),-
314 this, qFlagLocation("1""synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "356""362"));-
315-
316 connect(httpReply, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "358""364"),-
317 this, qFlagLocation("1""synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "359""365"));-
318-
319-
320-
321 } else if (!synchronous) {-
322 connect(httpReply,qFlagLocation("2""headerChanged()" "\0" __FILE__ ":" "364""370"), this, qFlagLocation("1""headerChangedSlot()" "\0" __FILE__ ":" "364""370"));-
323 connect(httpReply,qFlagLocation("2""finished()" "\0" __FILE__ ":" "365""371"), this, qFlagLocation("1""finishedSlot()" "\0" __FILE__ ":" "365""371"));-
324 connect(httpReply,qFlagLocation("2""finishedWithError(QNetworkReply::NetworkError,QString)" "\0" __FILE__ ":" "366""372"),-
325 this, qFlagLocation("1""finishedWithErrorSlot(QNetworkReply::NetworkError,QString)" "\0" __FILE__ ":" "367""373"));-
326-
327 connect(httpReply,qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "369""375"), this, qFlagLocation("1""readyReadSlot()" "\0" __FILE__ ":" "369""375"));-
328 connect(httpReply,qFlagLocation("2""dataReadProgress(qint64,qint64)" "\0" __FILE__ ":" "370""376"), this, qFlagLocation("1""dataReadProgressSlot(qint64,qint64)" "\0" __FILE__ ":" "370""376"));-
329-
330 connect(httpReply,qFlagLocation("2""encrypted()" "\0" __FILE__ ":" "372""378"), this, qFlagLocation("1""encryptedSlot()" "\0" __FILE__ ":" "372""378"));-
331 connect(httpReply,qFlagLocation("2""sslErrors(QList<QSslError>)" "\0" __FILE__ ":" "373""379"), this, qFlagLocation("1""sslErrorsSlot(QList<QSslError>)" "\0" __FILE__ ":" "373""379"));-
332 connect(httpReply,qFlagLocation("2""preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)" "\0" __FILE__ ":" "374""380"),-
333 this, qFlagLocation("1""preSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator*)" "\0" __FILE__ ":" "375""381"));-
334-
335-
336-
337-
338 connect(httpReply, qFlagLocation("2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "380""386"),-
339 this, qFlagLocation("2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "381""387"));-
340-
341 connect(httpReply, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "383""389"),-
342 this, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "384""390"));-
343-
344 }-
345-
346 connect(httpReply, qFlagLocation("2""cacheCredentials(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "388""394"),-
347 this, qFlagLocation("1""cacheCredentialsSlot(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "389""395"));-
348}-
349-
350-
351void QHttpThreadDelegate::abortRequest()-
352{-
353-
354-
355-
356 if (httpReply) {-
357 httpReply->abort();-
358 delete httpReply;-
359 httpReply = 0;-
360 }-
361-
362-
363 if (synchronous) {-
364 incomingErrorCode = QNetworkReply::TimeoutError;-
365 QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection);-
366 } else {-
367-
368 this->deleteLater();-
369 }-
370}-
371-
372void QHttpThreadDelegate::readBufferSizeChanged(qint64 size)-
373{-
374-
375-
376-
377 if (httpReply) {-
378 httpReply->setDownstreamLimited(size > 0);-
379 httpReply->setReadBufferSize(size);-
380 readBufferMaxSize = size;-
381 }-
382}-
383-
384void QHttpThreadDelegate::readBufferFreed(qint64 size)-
385{-
386 if (readBufferMaxSize) {-
387 bytesEmitted -= size;-
388-
389 QMetaObject::invokeMethod(this, "readyReadSlot", Qt::QueuedConnection);-
390 }-
391}-
392-
393void QHttpThreadDelegate::readyReadSlot()-
394{-
395 if (!httpReply)-
396 return;-
397-
398-
399 if (!downloadBuffer.isNull())-
400 return;-
401-
402 if (readBufferMaxSize) {-
403 if (bytesEmitted < readBufferMaxSize) {-
404 qint64 sizeEmitted = 0;-
405 while (httpReply->readAnyAvailable() && (sizeEmitted < (readBufferMaxSize-bytesEmitted))) {-
406 if (httpReply->sizeNextBlock() > (readBufferMaxSize-bytesEmitted)) {-
407 sizeEmitted = readBufferMaxSize-bytesEmitted;-
408 bytesEmitted += sizeEmitted;-
409 pendingDownloadData->fetchAndAddRelease(1);-
410 downloadData(httpReply->read(sizeEmitted));-
411 } else {-
412 sizeEmitted = httpReply->sizeNextBlock();-
413 bytesEmitted += sizeEmitted;-
414 pendingDownloadData->fetchAndAddRelease(1);-
415 downloadData(httpReply->readAny());-
416 }-
417 }-
418 } else {-
419-
420 }-
421-
422 } else {-
423 while (httpReply->readAnyAvailable()) {-
424 pendingDownloadData->fetchAndAddRelease(1);-
425 downloadData(httpReply->readAny());-
426 }-
427 }-
428}-
429-
430void QHttpThreadDelegate::finishedSlot()-
431{-
432 if (!httpReply)-
433 return;-
434-
435-
436-
437-
438-
439-
440 while (httpReply->readAnyAvailable()) {-
441 pendingDownloadData->fetchAndAddRelease(1);-
442 downloadData(httpReply->readAny());-
443 }-
444-
445-
446 if (ssl)-
447 sslConfigurationChanged(httpReply->sslConfiguration());-
448-
449-
450 if (httpReply->statusCode() >= 400) {-
451-
452 QString msg = QLatin1String("Error transferring %1 - server replied: %2"-
453 );-
454 msg = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase());-
455 error(statusCodeFromHttp(httpReply->statusCode(), httpRequest.url()), msg);-
456 }-
457-
458 if (httpRequest.isFollowRedirects() && httpReply->isRedirecting())-
459 redirected(httpReply->redirectUrl(), httpReply->statusCode(), httpReply->request().redirectCount() - 1);-
460-
461 downloadFinished();-
462-
463 QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection);-
464 QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection);-
465 httpReply = 0;-
466}-
467-
468void QHttpThreadDelegate::synchronousFinishedSlot()-
469{-
470 if (!httpReply)-
471 return;-
472-
473-
474-
475-
476 if (httpReply->statusCode() >= 400) {-
477-
478 QString msg = QLatin1String("Error transferring %1 - server replied: %2"-
479 );-
480 incomingErrorDetail = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase());-
481 incomingErrorCode = statusCodeFromHttp(httpReply->statusCode(), httpRequest.url());-
482 }-
483-
484 synchronousDownloadData = httpReply->readAll();-
485-
486 QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection);-
487 QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection);-
488 httpReply = 0;-
489}-
490-
491void QHttpThreadDelegate::finishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail)-
492{-
493 if (!httpReply)-
494 return;-
495-
496-
497-
498-
499-
500-
501 if (ssl)-
502 sslConfigurationChanged(httpReply->sslConfiguration());-
503-
504 error(errorCode,detail);-
505 downloadFinished();-
506-
507-
508 QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection);-
509 QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection);-
510 httpReply = 0;-
511}-
512-
513-
514void QHttpThreadDelegate::synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail)-
515{-
516 if (!httpReply)-
517 return;-
518-
519-
520-
521-
522 incomingErrorCode = errorCode;-
523 incomingErrorDetail = detail;-
524-
525 synchronousDownloadData = httpReply->readAll();-
526-
527 QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection);-
528 QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection);-
529 httpReply = 0;-
530}-
531-
532static void downloadBufferDeleter(char *ptr)-
533{-
534 delete[] ptr;-
535}-
536-
537void QHttpThreadDelegate::headerChangedSlot()-
538{-
539 if (!httpReply)-
540 return;-
541-
542-
543-
544-
545-
546-
547 if (ssl)-
548 sslConfigurationChanged(httpReply->sslConfiguration());-
549-
550-
551-
552 if (httpReply->supportsUserProvidedDownloadBuffer()-
553 && (downloadBufferMaximumSize > 0) && (httpReply->contentLength() <= downloadBufferMaximumSize)) {-
554 if (true) {-
555 char *buf = new char[httpReply->contentLength()];-
556 if (buf) {-
557 downloadBuffer = QSharedPointer<char>(buf, downloadBufferDeleter);-
558 httpReply->setUserProvidedDownloadBuffer(buf);-
559 }-
560 } else {
dead code: { }
-
561-
562 }
dead code: { }
-
563 }-
564-
565-
566 incomingHeaders = httpReply->header();-
567 incomingStatusCode = httpReply->statusCode();-
568 incomingReasonPhrase = httpReply->reasonPhrase();-
569 isPipeliningUsed = httpReply->isPipeliningUsed();-
570 incomingContentLength = httpReply->contentLength();-
571 isSpdyUsed = httpReply->isSpdyUsed();-
572-
573 downloadMetaData(incomingHeaders,-
574 incomingStatusCode,-
575 incomingReasonPhrase,-
576 isPipeliningUsed,-
577 downloadBuffer,-
578 incomingContentLength,-
579 isSpdyUsed);-
580}-
581-
582void QHttpThreadDelegate::synchronousHeaderChangedSlot()-
583{-
584 if (!httpReply)-
585 return;-
586-
587-
588-
589-
590-
591 incomingHeaders = httpReply->header();-
592 incomingStatusCode = httpReply->statusCode();-
593 incomingReasonPhrase = httpReply->reasonPhrase();-
594 isPipeliningUsed = httpReply->isPipeliningUsed();-
595 isSpdyUsed = httpReply->isSpdyUsed();-
596 incomingContentLength = httpReply->contentLength();-
597}-
598-
599-
600void QHttpThreadDelegate::dataReadProgressSlot(qint64 done, qint64 total)-
601{-
602-
603-
604 if (downloadBuffer.isNull())-
605 return;-
606-
607 pendingDownloadProgress->fetchAndAddRelease(1);-
608 downloadProgress(done, total);-
609}-
610-
611void QHttpThreadDelegate::cacheCredentialsSlot(const QHttpNetworkRequest &request, QAuthenticator *authenticator)-
612{-
613 authenticationManager->cacheCredentials(request.url(), authenticator);-
614}-
615-
616-
617-
618void QHttpThreadDelegate::encryptedSlot()-
619{-
620 if (!httpReply)-
621 return;-
622-
623 sslConfigurationChanged(httpReply->sslConfiguration());-
624 encrypted();-
625}-
626-
627void QHttpThreadDelegate::sslErrorsSlot(const QList<QSslError> &errors)-
628{-
629 if (!httpReply)-
630 return;-
631-
632 sslConfigurationChanged(httpReply->sslConfiguration());-
633-
634 bool ignoreAll = false;-
635 QList<QSslError> specificErrors;-
636 sslErrors(errors, &ignoreAll, &specificErrors);-
637 if (ignoreAll)-
638 httpReply->ignoreSslErrors();-
639 if (!specificErrors.isEmpty())-
640 httpReply->ignoreSslErrors(specificErrors);-
641}-
642-
643void QHttpThreadDelegate::preSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator *authenticator)-
644{-
645 if (!httpReply)-
646 return;-
647-
648 preSharedKeyAuthenticationRequired(authenticator);-
649}-
650-
651-
652void QHttpThreadDelegate::synchronousAuthenticationRequiredSlot(const QHttpNetworkRequest &request, QAuthenticator *a)-
653{-
654 if (!httpReply)-
655 return;-
656-
657 (void)request;;-
658-
659-
660-
661-
662-
663 QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedCredentials(httpRequest.url(), a);-
664 if (!credential.isNull()) {-
665 a->setUser(credential.user);-
666 a->setPassword(credential.password);-
667 }-
668-
669-
670 QObject::disconnect(httpReply, qFlagLocation("2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "712""718"),-
671 this, qFlagLocation("1""synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "713""719"));-
672}-
673-
674-
675void QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot(const QNetworkProxy &p, QAuthenticator *a)-
676{-
677 if (!httpReply)-
678 return;-
679-
680-
681-
682-
683-
684 QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedProxyCredentials(p, a);-
685 if (!credential.isNull()) {-
686 a->setUser(credential.user);-
687 a->setPassword(credential.password);-
688 }-
689-
690-
691-
692 QObject::disconnect(httpReply, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "734""740"),-
693 this, qFlagLocation("1""synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "735""741"));-
694-
695}-
696-
697-
698-
699-
700-
701-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9