summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-08 14:35:41 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-08 14:35:41 (GMT)
commit91323ecc5b884679e04b29072508fec6e765a666 (patch)
treef21d6803c2e6bf25c983ea4e21ff009e6d60ca05 /src/network
parent14e4314b5c2cfddb1e92fa1fefeaf7bea2dd6b3a (diff)
parent4336436b8113d6a80428d70beda40a89713d04db (diff)
downloadQt-91323ecc5b884679e04b29072508fec6e765a666.zip
Qt-91323ecc5b884679e04b29072508fec6e765a666.tar.gz
Qt-91323ecc5b884679e04b29072508fec6e765a666.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp10
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp21
-rw-r--r--src/network/access/qnetworkaccessmanager.h2
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp5
-rw-r--r--src/network/ssl/qsslsocket.cpp2
5 files changed, 37 insertions, 3 deletions
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index bd364cb..7517000 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -212,6 +212,7 @@ QNetworkAccessHttpBackendFactory::create(QNetworkAccessManager::Operation op,
case QNetworkAccessManager::PostOperation:
case QNetworkAccessManager::HeadOperation:
case QNetworkAccessManager::PutOperation:
+ case QNetworkAccessManager::DeleteOperation:
break;
default:
@@ -244,6 +245,10 @@ static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const
code = QNetworkReply::ContentNotFoundError;
break;
+ case 405: // Method Not Allowed
+ code = QNetworkReply::ContentOperationNotPermittedError;
+ break;
+
case 407:
code = QNetworkReply::ProxyAuthenticationRequiredError;
break;
@@ -485,6 +490,11 @@ void QNetworkAccessHttpBackend::postRequest()
httpRequest.setUploadByteDevice(createUploadByteDevice());
break;
+ case QNetworkAccessManager::DeleteOperation:
+ invalidateCache();
+ httpRequest.setOperation(QHttpNetworkRequest::Delete);
+ break;
+
default:
break; // can't happen
}
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index bf06ede..024f191 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -148,6 +148,9 @@ static void ensureInitialized()
\value PostOperation send the contents of an HTML form for
processing via HTTP POST (created with post())
+ \value DeleteOperation delete contents operation (created with
+ deleteResource())
+
\omitvalue UnknownOperation
\sa QNetworkReply::operation()
@@ -555,7 +558,7 @@ QNetworkReply *QNetworkAccessManager::head(const QNetworkRequest &request)
a new QNetworkReply object opened for reading which emits its
QIODevice::readyRead() signal whenever new data arrives.
- \sa post(), put()
+ \sa post(), put(), deleteResource()
*/
QNetworkReply *QNetworkAccessManager::get(const QNetworkRequest &request)
{
@@ -577,7 +580,7 @@ QNetworkReply *QNetworkAccessManager::get(const QNetworkRequest &request)
Note: sending a POST request on protocols other than HTTP and
HTTPS is undefined and will probably fail.
- \sa get(), put()
+ \sa get(), put(), deleteResource()
*/
QNetworkReply *QNetworkAccessManager::post(const QNetworkRequest &request, QIODevice *data)
{
@@ -642,6 +645,20 @@ QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, const
}
/*!
+ \since 4.6
+
+ This function is used to send a request to delete the resource
+ identified by the URL of \a request.
+ This feature is currently available for HTTP only, performing an HTTP DELETE request.
+
+ \sa get(), post(), put()
+*/
+QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &request)
+{
+ return d_func()->postProcess(createRequest(QNetworkAccessManager::DeleteOperation, request));
+}
+
+/*!
Returns a new QNetworkReply object to handle the operation \a op
and request \a req. The device \a outgoingData is always 0 for Get and
Head requests, but is the value passed to post() and put() in
diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h
index 4fe218e..79f512c 100644
--- a/src/network/access/qnetworkaccessmanager.h
+++ b/src/network/access/qnetworkaccessmanager.h
@@ -74,6 +74,7 @@ public:
GetOperation,
PutOperation,
PostOperation,
+ DeleteOperation,
UnknownOperation = 0
};
@@ -100,6 +101,7 @@ public:
QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data);
QNetworkReply *put(const QNetworkRequest &request, QIODevice *data);
QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data);
+ QNetworkReply *deleteResource(const QNetworkRequest &request);
Q_SIGNALS:
#ifndef QT_NO_NETWORKPROXY
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index b08d7b0..8c6cd31 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -570,6 +570,11 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quin
socketState = QAbstractSocket::UnconnectedState;
break;
}
+ if (value == WSAEHOSTUNREACH) {
+ setError(QAbstractSocket::NetworkError, HostUnreachableErrorString);
+ socketState = QAbstractSocket::UnconnectedState;
+ break;
+ }
}
// fall through
}
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 16033b6..0a049b8 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -480,7 +480,7 @@ QSslSocket::SslMode QSslSocket::mode() const
Returns true if the socket is encrypted; otherwise, false is returned.
An encrypted socket encrypts all data that is written by calling write()
- or putChar() before the data is written to the network, and descrypts all
+ or putChar() before the data is written to the network, and decrypts all
incoming data as the data is received from the network, before you call
read(), readLine() or getChar().