diff options
Diffstat (limited to 'src/network/access/qhttpnetworkrequest.cpp')
-rw-r--r-- | src/network/access/qhttpnetworkrequest.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index e39faae..7d0ce51 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -159,8 +159,11 @@ 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()) { - qWarning("content-type missing in HTTP POST, defaulting to application/octet-stream"); - ba += "Content-Type: application/octet-stream\r\n"; + //Content-Type is mandatory. We can't say anything about the encoding, but x-www-form-urlencoded is the most likely to work. + //This warning indicates a bug in application code not setting a required header. + //Note that if using QHttpMultipart, the content-type is set in QNetworkAccessManagerPrivate::prepareMultipart already + qWarning("content-type missing in HTTP POST, defaulting to application/x-www-form-urlencoded. Use QNetworkRequest::setHeader() to fix this problem."); + ba += "Content-Type: application/x-www-form-urlencoded\r\n"; } if (!request.d->uploadByteDevice && request.d->url.hasQuery()) { QByteArray query = request.d->url.encodedQuery(); |