diff options
Diffstat (limited to 'src/network/qhttp.cpp')
| -rw-r--r-- | src/network/qhttp.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/src/network/qhttp.cpp b/src/network/qhttp.cpp index d08f10f24..1d093f0b6 100644 --- a/src/network/qhttp.cpp +++ b/src/network/qhttp.cpp @@ -69,7 +69,7 @@ public: chunkedSize( -1 ), idleTimer( 0 ) { - pending.setAutoDelete( TRUE ); + pending.setAutoDelete( true ); } TQSocket socket; @@ -128,7 +128,7 @@ int TQHttpRequest::idCounter = 0; bool TQHttpRequest::hasRequestHeader() { - return FALSE; + return false; } TQHttpRequestHeader TQHttpRequest::requestHeader() @@ -148,14 +148,14 @@ public: TQHttpNormalRequest( const TQHttpRequestHeader &h, TQIODevice *d, TQIODevice *t ) : header(h), to(t) { - is_ba = FALSE; + is_ba = false; data.dev = d; } TQHttpNormalRequest( const TQHttpRequestHeader &h, TQByteArray *d, TQIODevice *t ) : header(h), to(t) { - is_ba = TRUE; + is_ba = true; data.ba = d; } @@ -216,7 +216,7 @@ void TQHttpNormalRequest::start( TQHttp *http ) bool TQHttpNormalRequest::hasRequestHeader() { - return TRUE; + return true; } TQHttpRequestHeader TQHttpNormalRequest::requestHeader() @@ -389,7 +389,7 @@ void TQHttpCloseRequest::start( TQHttp *http ) Constructs an empty HTTP header. */ TQHttpHeader::TQHttpHeader() - : valid( TRUE ) + : valid( true ) { } @@ -411,7 +411,7 @@ TQHttpHeader::TQHttpHeader( const TQHttpHeader& header ) key, colon, space, value. */ TQHttpHeader::TQHttpHeader( const TQString& str ) - : valid( TRUE ) + : valid( true ) { parse( str ); } @@ -434,7 +434,7 @@ TQHttpHeader& TQHttpHeader::operator=( const TQHttpHeader& h ) } /*! - Returns TRUE if the HTTP header is valid; otherwise returns FALSE. + Returns true if the HTTP header is valid; otherwise returns false. A TQHttpHeader is invalid if it was created by parsing a malformed string. */ @@ -448,7 +448,7 @@ bool TQHttpHeader::isValid() const the keys/values it finds. If the string is not parsed successfully the TQHttpHeader becomes \link isValid() invalid\endlink. - Returns TRUE if \a str was successfully parsed; otherwise returns FALSE. + Returns true if \a str was successfully parsed; otherwise returns false. \sa toString() */ @@ -457,12 +457,12 @@ bool TQHttpHeader::parse( const TQString& str ) TQStringList lst; int pos = str.find( '\n' ); if ( pos > 0 && str.at( pos - 1 ) == '\r' ) - lst = TQStringList::split( "\r\n", str.stripWhiteSpace(), FALSE ); + lst = TQStringList::split( "\r\n", str.stripWhiteSpace(), false ); else - lst = TQStringList::split( "\n", str.stripWhiteSpace(), FALSE ); + lst = TQStringList::split( "\n", str.stripWhiteSpace(), false ); if ( lst.isEmpty() ) - return TRUE; + return true; TQStringList lines; TQStringList::Iterator it = lst.begin(); @@ -483,11 +483,11 @@ bool TQHttpHeader::parse( const TQString& str ) it = lines.begin(); for( ; it != lines.end(); ++it ) { if ( !parseLine( *it, number++ ) ) { - valid = FALSE; - return FALSE; + valid = false; + return false; } } - return TRUE; + return true; } /*! \internal @@ -519,8 +519,8 @@ TQStringList TQHttpHeader::keys() const } /*! - Returns TRUE if the HTTP header has an entry with the given \a - key; otherwise returns FALSE. + Returns true if the HTTP header has an entry with the given \a + key; otherwise returns false. \sa value() setValue() keys() */ @@ -557,8 +557,8 @@ void TQHttpHeader::removeValue( const TQString& key ) /*! \internal Parses the single HTTP header line \a line which has the format key, colon, space, value, and adds key/value to the headers. The - linenumber is \a number. Returns TRUE if the line was successfully - parsed and the key/value added; otherwise returns FALSE. + linenumber is \a number. Returns true if the line was successfully + parsed and the key/value added; otherwise returns false. \sa parse() */ @@ -566,11 +566,11 @@ bool TQHttpHeader::parseLine( const TQString& line, int ) { int i = line.find( ":" ); if ( i == -1 ) - return FALSE; + return false; values.insert( line.left( i ).stripWhiteSpace().lower(), line.mid( i + 1 ).stripWhiteSpace() ); - return TRUE; + return true; } /*! @@ -595,8 +595,8 @@ TQString TQHttpHeader::toString() const } /*! - Returns TRUE if the header has an entry for the special HTTP - header field \c content-length; otherwise returns FALSE. + Returns true if the header has an entry for the special HTTP + header field \c content-length; otherwise returns false. \sa contentLength() setContentLength() */ @@ -628,8 +628,8 @@ void TQHttpHeader::setContentLength( int len ) } /*! - Returns TRUE if the header has an entry for the the special HTTP - header field \c content-type; otherwise returns FALSE. + Returns true if the header has an entry for the the special HTTP + header field \c content-type; otherwise returns false. \sa contentType() setContentType() */ @@ -701,7 +701,7 @@ void TQHttpHeader::setContentType( const TQString& type ) */ TQHttpResponseHeader::TQHttpResponseHeader() { - setValid( FALSE ); + setValid( false ); } /*! @@ -744,7 +744,7 @@ TQHttpResponseHeader::TQHttpResponseHeader( const TQString& str ) */ void TQHttpResponseHeader::setStatusLine( int code, const TQString& text, int majorVer, int minorVer ) { - setValid( TRUE ); + setValid( true ); statCode = code; reasonPhr = text; majVer = majorVer; @@ -800,7 +800,7 @@ bool TQHttpResponseHeader::parseLine( const TQString& line, int number ) TQString l = line.simplifyWhiteSpace(); if ( l.length() < 10 ) - return FALSE; + return false; if ( l.left( 5 ) == "HTTP/" && l[5].isDigit() && l[6] == '.' && l[7].isDigit() && l[8] == ' ' && l[9].isDigit() ) { @@ -816,10 +816,10 @@ bool TQHttpResponseHeader::parseLine( const TQString& line, int number ) reasonPhr = TQString::null; } } else { - return FALSE; + return false; } - return TRUE; + return true; } /*! \reimp @@ -878,7 +878,7 @@ TQString TQHttpResponseHeader::toString() const TQHttpRequestHeader::TQHttpRequestHeader() : TQHttpHeader() { - setValid( FALSE ); + setValid( false ); } /*! @@ -920,7 +920,7 @@ TQHttpRequestHeader::TQHttpRequestHeader( const TQString& str ) */ void TQHttpRequestHeader::setRequest( const TQString& method, const TQString& path, int majorVer, int minorVer ) { - setValid( TRUE ); + setValid( true ); m = method; p = path; majVer = majorVer; @@ -985,13 +985,13 @@ bool TQHttpRequestHeader::parseLine( const TQString& line, int number ) v[5].isDigit() && v[6] == '.' && v[7].isDigit() ) { majVer = v[5].latin1() - '0'; minVer = v[7].latin1() - '0'; - return TRUE; + return true; } } } } - return FALSE; + return false; } /*! \reimp @@ -1096,7 +1096,7 @@ TQString TQHttpRequestHeader::toString() const \code requestStarted( 1 ) - requestFinished( 1, FALSE ) + requestFinished( 1, false ) requestStarted( 2 ) stateChanged( Connecting ) @@ -1109,9 +1109,9 @@ TQString TQHttpRequestHeader::toString() const dataReadProgress( 18300, 0 ) readyRead( responseheader ) stateChanged( Connected ) - requestFinished( 2, FALSE ) + requestFinished( 2, false ) - done( FALSE ) + done( false ) stateChanged( Closing ) stateChanged( Unconnected ) @@ -1152,13 +1152,13 @@ TQString TQHttpRequestHeader::toString() const \code requestStarted( 1 ) - requestFinished( 1, FALSE ) + requestFinished( 1, false ) requestStarted( 2 ) stateChanged( HostLookup ) - requestFinished( 2, TRUE ) + requestFinished( 2, true ) - done( TRUE ) + done( true ) stateChanged( Unconnected ) \endcode @@ -1384,8 +1384,8 @@ TQHttp::~TQHttp() \fn void TQHttp::requestFinished( int id, bool error ) This signal is emitted when processing the request identified by - \a id has finished. \a error is TRUE if an error occurred during - the processing; otherwise \a error is FALSE. + \a id has finished. \a error is true if an error occurred during + the processing; otherwise \a error is false. \sa requestStarted() done() error() errorString() */ @@ -1395,8 +1395,8 @@ TQHttp::~TQHttp() This signal is emitted when the last pending request has finished; (it is emitted after the last request's requestFinished() signal). - \a error is TRUE if an error occurred during the processing; - otherwise \a error is FALSE. + \a error is true if an error occurred during the processing; + otherwise \a error is false. \sa requestFinished() error() errorString() */ @@ -1405,12 +1405,12 @@ TQHttp::~TQHttp() Aborts the current request and deletes all scheduled requests. For the current request, the requestFinished() signal with the \c - error argument \c TRUE is emitted. For all other requests that are + error argument \c true is emitted. For all other requests that are affected by the abort(), no signals are emitted. Since this slot also deletes the scheduled requests, there are no requests left and the done() signal is emitted (with the \c error - argument \c TRUE). + argument \c true). \sa clearPendingRequests() */ @@ -1497,7 +1497,7 @@ int TQHttp::currentId() const Returns the request header of the HTTP request being executed. If the request is one issued by setHost() or closeConnection(), it returns an invalid request header, i.e. - TQHttpRequestHeader::isValid() returns FALSE. + TQHttpRequestHeader::isValid() returns false. \sa currentId() */ @@ -1546,8 +1546,8 @@ TQIODevice* TQHttp::currentDestinationDevice() const } /*! - Returns TRUE if there are any requests scheduled that have not yet - been executed; otherwise returns FALSE. + Returns true if there are any requests scheduled that have not yet + been executed; otherwise returns false. The request that is being executed is \e not considered as a scheduled request. @@ -1825,10 +1825,10 @@ void TQHttp::finishedWithSuccess() if ( r == 0 ) return; - emit requestFinished( r->id, FALSE ); + emit requestFinished( r->id, false ); d->pending.removeFirst(); if ( d->pending.isEmpty() ) { - emit done( FALSE ); + emit done( false ); } else { startNextRequest(); } @@ -1842,10 +1842,10 @@ void TQHttp::finishedWithError( const TQString& detail, int errorCode ) d->error = (Error)errorCode; d->errorString = detail; - emit requestFinished( r->id, TRUE ); + emit requestFinished( r->id, true ); d->pending.clear(); - emit done( TRUE ); + emit done( true ); } void TQHttp::slotClosed() @@ -1944,19 +1944,19 @@ void TQHttp::slotReadyRead() if ( d->state != Reading ) { setState( Reading ); d->buffer = TQByteArray(); - d->readHeader = TRUE; + d->readHeader = true; d->headerStr = ""; d->bytesDone = 0; d->chunkedSize = -1; } while ( d->readHeader ) { - bool end = FALSE; + bool end = false; TQString tmp; while ( !end && d->socket.canReadLine() ) { tmp = d->socket.readLine(); if ( tmp == "\r\n" || tmp == "\n" ) - end = TRUE; + end = true; else d->headerStr += tmp; } @@ -1983,7 +1983,7 @@ void TQHttp::slotReadyRead() // POST method, we send both the request header and data in // one chunk. if (d->response.statusCode() != 100) { - d->readHeader = FALSE; + d->readHeader = false; if ( d->response.hasKey( "transfer-encoding" ) && d->response.value( "transfer-encoding" ).lower().contains( "chunked" ) ) d->chunkedSize = 0; @@ -1993,10 +1993,10 @@ void TQHttp::slotReadyRead() } if ( !d->readHeader ) { - bool everythingRead = FALSE; + bool everythingRead = false; if ( currentRequest().method() == "HEAD" ) { - everythingRead = TRUE; + everythingRead = true; } else { TQ_ULONG n = d->socket.bytesAvailable(); TQByteArray *arr = 0; @@ -2030,7 +2030,7 @@ void TQHttp::slotReadyRead() d->chunkedSize = -1; } if ( d->chunkedSize == -1 ) { - everythingRead = TRUE; + everythingRead = true; break; } @@ -2075,7 +2075,7 @@ void TQHttp::slotReadyRead() arr->resize( read ); } if ( d->bytesDone + bytesAvailable() + n == d->response.contentLength() ) - everythingRead = TRUE; + everythingRead = true; } else if ( n > 0 ) { // workaround for VC++ bug TQByteArray temp = d->socket.readAll(); @@ -2137,7 +2137,7 @@ TQHttp::State TQHttp::state() const /*! Returns the last error that occurred. This is useful to find out what happened when receiving a requestFinished() or a done() - signal with the \c error argument \c TRUE. + signal with the \c error argument \c true. If you start a new request, the error status is reset to \c NoError. */ @@ -2150,7 +2150,7 @@ TQHttp::Error TQHttp::error() const Returns a human-readable description of the last error that occurred. This is useful to present a error message to the user when receiving a requestFinished() or a done() signal with the \c - error argument \c TRUE. + error argument \c true. */ TQString TQHttp::errorString() const { |
