summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index 1325f105cf..cd6acc82cd 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -158,8 +158,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.query(QUrl::FullyEncoded).toLatin1();