diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-02-16 15:57:01 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-02-17 10:21:43 (GMT) |
commit | afedf4a56775d8637146a0c1df17539c3b50a4ae (patch) | |
tree | 69be43f75cb63459e300110fd66e793102a023c0 /src/network/access | |
parent | da17f57b058d39b82de1a21d8d6203004b22a063 (diff) | |
download | Qt-afedf4a56775d8637146a0c1df17539c3b50a4ae.zip Qt-afedf4a56775d8637146a0c1df17539c3b50a4ae.tar.gz Qt-afedf4a56775d8637146a0c1df17539c3b50a4ae.tar.bz2 |
QNAM HTTP: Some micro optimization in QHttpNetworkRequest
Reviewed-by: Thiago
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qhttpnetworkrequest.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index 302c91b..fd1aa22 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -132,25 +132,32 @@ QByteArray QHttpNetworkRequestPrivate::uri(bool throughProxy) const QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request, bool throughProxy) { QByteArray ba = request.d->methodName(); - QByteArray uri = request.d->uri(throughProxy); - ba += ' ' + uri; + ba += ' '; + ba += request.d->uri(throughProxy); - QString majorVersion = QString::number(request.majorVersion()); - QString minorVersion = QString::number(request.minorVersion()); - ba += " HTTP/" + majorVersion.toLatin1() + '.' + minorVersion.toLatin1() + "\r\n"; + ba += " HTTP/"; + ba += QByteArray::number(request.majorVersion()); + ba += '.'; + ba += QByteArray::number(request.minorVersion()); + ba += "\r\n"; QList<QPair<QByteArray, QByteArray> > fields = request.header(); QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin(); - for (; it != fields.constEnd(); ++it) - ba += it->first + ": " + it->second + "\r\n"; + for (; it != fields.constEnd(); ++it) { + ba += it->first; + ba += ": "; + ba += it->second; + ba += "\r\n"; + } 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.d->uploadByteDevice && request.d->url.hasQuery()) { QByteArray query = request.d->url.encodedQuery(); - ba += "Content-Length: "+ QByteArray::number(query.size()) + "\r\n"; - ba += "\r\n"; + ba += "Content-Length: "; + ba += QByteArray::number(query.size()); + ba += "\r\n\r\n"; ba += query; } else { ba += "\r\n"; |