equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtNetwork module of the Qt Toolkit. |
7 ** This file is part of the QtNetwork module of the Qt Toolkit. |
8 ** |
8 ** |
685 |
685 |
686 // fast path for GET on file:// URLs |
686 // fast path for GET on file:// URLs |
687 // Also if the scheme is empty we consider it a file. |
687 // Also if the scheme is empty we consider it a file. |
688 // The QNetworkAccessFileBackend will right now only be used |
688 // The QNetworkAccessFileBackend will right now only be used |
689 // for PUT or qrc:// |
689 // for PUT or qrc:// |
690 if (op == QNetworkAccessManager::GetOperation |
690 if ((op == QNetworkAccessManager::GetOperation || op == QNetworkAccessManager::HeadOperation) |
691 && (req.url().scheme() == QLatin1String("file") |
691 && (req.url().scheme() == QLatin1String("file") |
692 || req.url().scheme().isEmpty())) { |
692 || req.url().scheme().isEmpty())) { |
693 return new QFileNetworkReply(this, req); |
693 return new QFileNetworkReply(this, req, op); |
694 } |
694 } |
695 |
695 |
696 QNetworkRequest request = req; |
696 QNetworkRequest request = req; |
697 if (!request.header(QNetworkRequest::ContentLengthHeader).isValid() && |
697 if (!request.header(QNetworkRequest::ContentLengthHeader).isValid() && |
698 outgoingData && !outgoingData->isSequential()) { |
698 outgoingData && !outgoingData->isSequential()) { |
721 } |
721 } |
722 |
722 |
723 // third step: find a backend |
723 // third step: find a backend |
724 priv->backend = d->findBackend(op, request); |
724 priv->backend = d->findBackend(op, request); |
725 |
725 |
726 // fourth step: setup the reply |
|
727 priv->setup(op, request, outgoingData); |
|
728 #ifndef QT_NO_NETWORKPROXY |
726 #ifndef QT_NO_NETWORKPROXY |
729 QList<QNetworkProxy> proxyList = d->queryProxy(QNetworkProxyQuery(request.url())); |
727 QList<QNetworkProxy> proxyList = d->queryProxy(QNetworkProxyQuery(request.url())); |
730 priv->proxyList = proxyList; |
728 priv->proxyList = proxyList; |
731 #endif |
729 #endif |
732 if (priv->backend) { |
730 if (priv->backend) { |
733 priv->backend->setParent(reply); |
731 priv->backend->setParent(reply); |
734 priv->backend->reply = priv; |
732 priv->backend->reply = priv; |
735 } |
733 } |
|
734 // fourth step: setup the reply |
|
735 priv->setup(op, request, outgoingData); |
736 |
736 |
737 #ifndef QT_NO_OPENSSL |
737 #ifndef QT_NO_OPENSSL |
738 reply->setSslConfiguration(request.sslConfiguration()); |
738 reply->setSslConfiguration(request.sslConfiguration()); |
739 #endif |
739 #endif |
740 return reply; |
740 return reply; |