summaryrefslogtreecommitdiffstats
ModeNameSize
-rw-r--r--.commit-template324logstatsplain
-rw-r--r--.gitignore3872logstatsplain
-rwxr-xr-x.hgignore2283logstatsplain
-rw-r--r--INSTALL742logstatsplain
-rw-r--r--LGPL_EXCEPTION.txt1187logstatsplain
-rw-r--r--LICENSE.FDL22961logstatsplain
-rw-r--r--LICENSE.LGPL26835logstatsplain
-rw-r--r--LICENSE.PREVIEW.COMMERCIAL31573logstatsplain
d---------bin565logstatsplain
d---------config.tests193logstatsplain
-rwxr-xr-xconfigure303214logstatsplain
-rwxr-xr-xconfigure.exe1329152logstatsplain
d---------demos1079logstatsplain
d---------dist4810logstatsplain
d---------doc65logstatsplain
d---------examples1527logstatsplain
-rw-r--r--header.BSD2044logstatsplain
-rw-r--r--header.FDL1034logstatsplain
-rw-r--r--header.LGPL1491logstatsplain
-rw-r--r--header.LGPL-ONLY986logstatsplain
d---------imports38logstatsplain
d---------lib66logstatsplain
d---------mkspecs4038logstatsplain
-rw-r--r--projects.pro6950logstatsplain
d---------qmake736logstatsplain
d---------src1005logstatsplain
d---------templates80logstatsplain
d---------tests276logstatsplain
d---------tools1007logstatsplain
d---------translations3861logstatsplain
d---------util536logstatsplain
(uploadByteDevice == other.uploadByteDevice); } QByteArray QHttpNetworkRequestPrivate::methodName() const { QByteArray ba; switch (operation) { case QHttpNetworkRequest::Options: ba += "OPTIONS"; break; case QHttpNetworkRequest::Get: ba += "GET"; break; case QHttpNetworkRequest::Head: ba += "HEAD"; break; case QHttpNetworkRequest::Post: ba += "POST"; break; case QHttpNetworkRequest::Put: ba += "PUT"; break; case QHttpNetworkRequest::Delete: ba += "DELETE"; break; case QHttpNetworkRequest::Trace: ba += "TRACE"; break; case QHttpNetworkRequest::Connect: ba += "CONNECT"; break; default: break; } return ba; } QByteArray QHttpNetworkRequestPrivate::uri(bool throughProxy) const { QUrl::FormattingOptions format(QUrl::RemoveFragment); // for POST, query data is send as content if (operation == QHttpNetworkRequest::Post && !uploadByteDevice) format |= QUrl::RemoveQuery; // for requests through proxy, the Request-URI contains full url if (throughProxy) format |= QUrl::RemoveUserInfo; else format |= QUrl::RemoveScheme | QUrl::RemoveAuthority; QByteArray uri = url.toEncoded(format); if (uri.isEmpty() || (throughProxy && url.path().isEmpty())) uri += '/'; return uri; } QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request, bool throughProxy) { QByteArray ba = request.d->methodName(); QByteArray uri = request.d->uri(throughProxy); ba += ' ' + uri; QString majorVersion = QString::number(request.majorVersion()); QString minorVersion = QString::number(request.minorVersion()); ba += " HTTP/" + majorVersion.toLatin1() + '.' + minorVersion.toLatin1() + "\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"; 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 += query; } else { ba += "\r\n"; } } else { ba += "\r\n"; } return ba; } // QHttpNetworkRequest QHttpNetworkRequest::QHttpNetworkRequest(const QUrl &url, Operation operation, Priority priority) : d(new QHttpNetworkRequestPrivate(operation, priority, url)) { } QHttpNetworkRequest::QHttpNetworkRequest(const QHttpNetworkRequest &other) : QHttpNetworkHeader(other), d(other.d) { } QHttpNetworkRequest::~QHttpNetworkRequest() { } QUrl QHttpNetworkRequest::url() const { return d->url; } void QHttpNetworkRequest::setUrl(const QUrl &url) { d->url = url; } qint64 QHttpNetworkRequest::contentLength() const { return d->contentLength(); } void QHttpNetworkRequest::setContentLength(qint64 length) { d->setContentLength(length); } QList<QPair<QByteArray, QByteArray> > QHttpNetworkRequest::header() const { return d->fields; } QByteArray QHttpNetworkRequest::headerField(const QByteArray &name, const QByteArray &defaultValue) const { return d->headerField(name, defaultValue); } void QHttpNetworkRequest::setHeaderField(const QByteArray &name, const QByteArray &data) { d->setHeaderField(name, data); } QHttpNetworkRequest &QHttpNetworkRequest::operator=(const QHttpNetworkRequest &other) { d = other.d; return *this; } bool QHttpNetworkRequest::operator==(const QHttpNetworkRequest &other) const { return d->operator==(*other.d); } QHttpNetworkRequest::Operation QHttpNetworkRequest::operation() const { return d->operation; } void QHttpNetworkRequest::setOperation(Operation operation) { d->operation = operation; } QHttpNetworkRequest::Priority QHttpNetworkRequest::priority() const { return d->priority; } void QHttpNetworkRequest::setPriority(Priority priority) { d->priority = priority; } bool QHttpNetworkRequest::isPipeliningAllowed() const { return d->pipeliningAllowed; } void QHttpNetworkRequest::setPipeliningAllowed(bool b) { d->pipeliningAllowed = b; } void QHttpNetworkRequest::setUploadByteDevice(QNonContiguousByteDevice *bd) { d->uploadByteDevice = bd; } QNonContiguousByteDevice* QHttpNetworkRequest::uploadByteDevice() const { return d->uploadByteDevice; } int QHttpNetworkRequest::majorVersion() const { return 1; } int QHttpNetworkRequest::minorVersion() const { return 1; } QT_END_NAMESPACE #endif