Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/network/access/qhttpnetworkrequest.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    5050        QHttpNetworkRequest::Priority pri, const QUrl &newUrl)
    5151    : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0),
    52       autoDecompress(false), pipeliningAllowed(false)
     52      autoDecompress(false), pipeliningAllowed(false)
    5353{
    5454}
     
    6262    autoDecompress = other.autoDecompress;
    6363    pipeliningAllowed = other.pipeliningAllowed;
     64
     65
    6466}
    6567
     
    7779QByteArray QHttpNetworkRequestPrivate::methodName() const
    7880{
    79     QByteArray ba;
    8081    switch (operation) {
     82
     83
     84
     85
     86
     87
     88
     89
     90
    8191    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";
    9293        break;
    9394    case QHttpNetworkRequest::Put:
    94         ba += "PUT";
     95        "PUT";
    9596        break;
    9697    case QHttpNetworkRequest::Delete:
    97         ba += "DELETE";
     98        "DELETE";
    9899        break;
    99100    case QHttpNetworkRequest::Trace:
    100         ba += "TRACE";
     101        "TRACE";
    101102        break;
    102103    case QHttpNetworkRequest::Connect:
    103         ba += "CONNECT";
     104        return "CONNECT";
     105        break;
     106    case QHttpNetworkRequest::Custom:
     107        return customVerb;
    104108        break;
    105109    default:
    106110        break;
    107111    }
    108     return ba;
     112    return ;
    109113}
    110114
     
    129133QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request, bool throughProxy)
    130134{
    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 
    139135    QList<QPair<QByteArray, QByteArray> > fields = request.header();
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
    140149    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    }
    143157    if (request.d->operation == QHttpNetworkRequest::Post) {
    144158        // add content type, if not set in the request