Changeset 846 for trunk/src/network/access/qhttpnetworkrequest.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/network/access/qhttpnetworkrequest.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 50 50 QHttpNetworkRequest::Priority pri, const QUrl &newUrl) 51 51 : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0), 52 autoDecompress(false), pipeliningAllowed(false) 52 autoDecompress(false), pipeliningAllowed(false) 53 53 { 54 54 } … … 62 62 autoDecompress = other.autoDecompress; 63 63 pipeliningAllowed = other.pipeliningAllowed; 64 65 64 66 } 65 67 … … 77 79 QByteArray QHttpNetworkRequestPrivate::methodName() const 78 80 { 79 QByteArray ba;80 81 switch (operation) { 82 83 84 85 86 87 88 89 90 81 91 case QHttpNetworkRequest::Options: 82 ba += "OPTIONS"; 83 break; 84 case QHttpNetworkRequest::Get: 85 ba += "GET"; 86 break; 87 case QHttpNetworkRequest::Head: 88 ba += "HEAD"; 89 break; 90 case QHttpNetworkRequest::Post: 91 ba += "POST"; 92 return "OPTIONS"; 92 93 break; 93 94 case QHttpNetworkRequest::Put: 94 ba +="PUT";95 "PUT"; 95 96 break; 96 97 case QHttpNetworkRequest::Delete: 97 ba +="DELETE";98 "DELETE"; 98 99 break; 99 100 case QHttpNetworkRequest::Trace: 100 ba +="TRACE";101 "TRACE"; 101 102 break; 102 103 case QHttpNetworkRequest::Connect: 103 ba += "CONNECT"; 104 return "CONNECT"; 105 break; 106 case QHttpNetworkRequest::Custom: 107 return customVerb; 104 108 break; 105 109 default: 106 110 break; 107 111 } 108 return ba;112 return ; 109 113 } 110 114 … … 129 133 QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request, bool throughProxy) 130 134 { 131 QByteArray ba = request.d->methodName();132 QByteArray uri = request.d->uri(throughProxy);133 ba += ' ' + uri;134 135 QString majorVersion = QString::number(request.majorVersion());136 QString minorVersion = QString::number(request.minorVersion());137 ba += " HTTP/" + majorVersion.toLatin1() + '.' + minorVersion.toLatin1() + "\r\n";138 139 135 QList<QPair<QByteArray, QByteArray> > fields = request.header(); 136 137 138 139 140 141 142 143 144 145 146 147 148 140 149 QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin(); 141 for (; it != fields.constEnd(); ++it) 142 ba += it->first + ": " + it->second + "\r\n"; 150 QList<QPair<QByteArray, QByteArray> >::const_iterator endIt = fields.constEnd(); 151 for (; it != endIt; ++it) { 152 ba += it->first; 153 ba += ": "; 154 ba += it->second; 155 ba += "\r\n"; 156 } 143 157 if (request.d->operation == QHttpNetworkRequest::Post) { 144 158 // add content type, if not set in the request …