summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Hartmann <9qgm-76ea@xemaps.com>2012-04-22 19:20:27 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-05-14 15:32:41 (GMT)
commit9a2ac50aea0892b640a6192b00574eb4efa19361 (patch)
tree3b64821535e03669556afc4c9e4e300b66c7872c
parentc3eb2e63425c47b8e3eeb7416e225fab10c5c15a (diff)
downloadQt-9a2ac50aea0892b640a6192b00574eb4efa19361.zip
Qt-9a2ac50aea0892b640a6192b00574eb4efa19361.tar.gz
Qt-9a2ac50aea0892b640a6192b00574eb4efa19361.tar.bz2
QHttpMultiPart: supply new line at the end of the body
... to conform to RFC 2046 (section 5.1.1). Apparently IIS had problems without the new line. Task-number: QTBUG-25429 Change-Id: Ia619bbdcebd407b2716bc467323634e4c8d77bcd Reviewed-by: Shane Kearns <shane.kearns@accenture.com> (cherry picked from commit 314e590d67db08690b31930e53ca61cedfc4d1e2) Reviewed-by: Peter Hartmann <9qgm-76ea@xemaps.com>
-rw-r--r--src/network/access/qhttpmultipart.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/access/qhttpmultipart.cpp b/src/network/access/qhttpmultipart.cpp
index 6de7a80..dc23405 100644
--- a/src/network/access/qhttpmultipart.cpp
+++ b/src/network/access/qhttpmultipart.cpp
@@ -456,7 +456,7 @@ qint64 QHttpMultiPartIODevice::size() const
// and 2 bytes for the "\r\n" after the content
currentSize += boundaryCount + 4 + multiPart->parts.at(a).d->size() + 2;
}
- currentSize += boundaryCount + 4; // size for ending boundary and 2 beginning and ending dashes
+ currentSize += boundaryCount + 6; // size for ending boundary, 2 beginning and ending dashes and "\r\n"
deviceSize = currentSize;
}
return deviceSize;
@@ -527,7 +527,7 @@ qint64 QHttpMultiPartIODevice::readData(char *data, qint64 maxSize)
}
// check whether we need to return the final boundary
if (bytesRead < maxSize && index == multiPart->parts.count()) {
- QByteArray finalBoundary = "--" + multiPart->boundary + "--";
+ QByteArray finalBoundary = "--" + multiPart->boundary + "--\r\n";
qint64 boundaryIndex = readPointer + finalBoundary.count() - size();
qint64 lastBoundaryBytesRead = qMin(finalBoundary.count() - boundaryIndex, maxSize - bytesRead);
memcpy(data + bytesRead, finalBoundary.constData() + boundaryIndex, lastBoundaryBytesRead);