summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-02-01 11:18:19 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-02-03 14:37:53 (GMT)
commit2a6d7fcde4092f41230841bbe4c078f2e42166bb (patch)
tree5d66180780d7d8d85fd1f9b46bf7b3d4e702aa1f /src/network/access
parentf60ed3a2da4889cce6afbb059773a6c070929bb6 (diff)
downloadQt-2a6d7fcde4092f41230841bbe4c078f2e42166bb.zip
Qt-2a6d7fcde4092f41230841bbe4c078f2e42166bb.tar.gz
Qt-2a6d7fcde4092f41230841bbe4c078f2e42166bb.tar.bz2
Change default type for http POST to application/octet-stream
When the application did not set the mandatory content-type header for POST requests, Qt was putting in application/x-www-urlencoded. While this is the default for HTML forms, it isn't valid because Qt was not also encoding the data. Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index d2f3212..d4c735d 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -158,8 +158,10 @@ QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request
}
if (request.d->operation == QHttpNetworkRequest::Post) {
// add content type, if not set in the request
- if (request.headerField("content-type").isEmpty())
- ba += "Content-Type: application/x-www-form-urlencoded\r\n";
+ if (request.headerField("content-type").isEmpty()) {
+ qWarning("content-type missing in HTTP POST, defaulting to application/octet-stream");
+ ba += "Content-Type: application/octet-stream\r\n";
+ }
if (!request.d->uploadByteDevice && request.d->url.hasQuery()) {
QByteArray query = request.d->url.encodedQuery();
ba += "Content-Length: ";