From kfm-devel Sun Jul 22 05:14:04 2007 From: Christian Weilbach Date: Sun, 22 Jul 2007 05:14:04 +0000 To: kfm-devel Subject: KIO::http_post bug fixed Message-Id: <200707220714.04912.christian_weilbach () web ! de> X-MARC-Message: https://marc.info/?l=kfm-devel&m=118519940627678 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_ceuoGJFnzpD94KS" --Boundary-00=_ceuoGJFnzpD94KS Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, as actually nobody helped me, I've helped myself and have fixed another http_post bug. This one is in the http.cpp file and is about header parsing. As Thiago has pointed out in IRC kDebug( xxxx ) does not work, so I have replaced it by kDebug(). Otherwise it will only throw the header, which might be o.k., but was to less for me. The actual bugfix is the part about metaData( "content-length" ), which is not checked for its length correctly and therefore may introduce one carriage return to much, therefore the "Content-length: xxx" is not regarded as part of the header by the server. Another bug fixed imho is the replacement of isNull() with isEmpty(), actually there are many accurances of isNull() in http.cpp, which in my opinion should be replaced as much as possible with isEmpty(). Another bug fixed by Antonio had the same problem. Cheers and I hope you can fix it upstream soon, Christian --Boundary-00=_ceuoGJFnzpD94KS Content-Type: text/x-diff; charset="utf-8"; name="kio_content_length_patch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kio_content_length_patch.diff" Index: http.cpp =================================================================== --- http.cpp (Revision 690648) +++ http.cpp (Arbeitskopie) @@ -217,7 +217,7 @@ void HTTPProtocol::reparseConfiguration() { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::reparseConfiguration" << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::reparseConfiguration" << endl; m_strProxyRealm.clear(); m_strProxyAuthorization.clear(); @@ -273,13 +273,13 @@ m_proxyURL = proxy; m_bUseProxy = m_proxyURL.isValid(); - kDebug(7113) << "(" << m_pid << ") Using proxy: " << m_bUseProxy << + kDebug() << "(" << m_pid << ") Using proxy: " << m_bUseProxy << " URL: " << m_proxyURL.url() << " Realm: " << m_strProxyRealm << endl; } m_bPersistentProxyConnection = config()->readEntry("PersistentProxyConnection", false); - kDebug(7113) << "(" << m_pid << ") Enable Persistent Proxy Connection: " + kDebug() << "(" << m_pid << ") Enable Persistent Proxy Connection: " << m_bPersistentProxyConnection << endl; m_request.bUseCookiejar = config()->readEntry("Cookies", false); @@ -290,8 +290,8 @@ m_maxCacheAge = config()->readEntry("MaxCacheAge", DEFAULT_MAX_CACHE_AGE); m_request.window = config()->readEntry("window-id"); - kDebug(7113) << "(" << m_pid << ") Window Id = " << m_request.window << endl; - kDebug(7113) << "(" << m_pid << ") ssl_was_in_use = " + kDebug() << "(" << m_pid << ") Window Id = " << m_request.window << endl; + kDebug() << "(" << m_pid << ") ssl_was_in_use = " << metaData ("ssl_was_in_use") << endl; m_request.referrer.clear(); @@ -364,7 +364,7 @@ { m_bNeedTunnel = true; setRealHost( m_request.hostname ); - kDebug(7113) << "(" << m_pid << ") SSL tunnel: Setting real hostname to: " + kDebug() << "(" << m_pid << ") SSL tunnel: Setting real hostname to: " << m_request.hostname << endl; } else @@ -438,7 +438,7 @@ m_bIsTunneled = false; - kDebug(7113) << "(" << m_pid << ") Hostname is now: " << m_request.hostname << + kDebug() << "(" << m_pid << ") Hostname is now: " << m_request.hostname << " (" << m_request.encoded_hostname << ")" < 0 && verNo < 3) { m_davHostOk = true; - kDebug(7113) << "Server supports DAV version " << verNo << "." << endl; + kDebug() << "Server supports DAV version " << verNo << "." << endl; } } @@ -1156,7 +1156,7 @@ void HTTPProtocol::mkdir( const KUrl& url, int ) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::mkdir " << url.url() + kDebug() << "(" << m_pid << ") HTTPProtocol::mkdir " << url.url() << endl; if ( !checkRequestUrl( url ) ) @@ -1178,7 +1178,7 @@ void HTTPProtocol::get( const KUrl& url ) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::get " << url.url() + kDebug() << "(" << m_pid << ") HTTPProtocol::get " << url.url() << endl; if ( !checkRequestUrl( url ) ) @@ -1203,7 +1203,7 @@ void HTTPProtocol::put( const KUrl &url, int, bool overwrite, bool) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::put " << url.prettyUrl() + kDebug() << "(" << m_pid << ") HTTPProtocol::put " << url.prettyUrl() << endl; if ( !checkRequestUrl( url ) ) @@ -1250,11 +1250,11 @@ retrieveHeader( false ); - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::put error = " << m_bError << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::put error = " << m_bError << endl; if (m_bError) return; - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::put responseCode = " << m_responseCode << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::put responseCode = " << m_responseCode << endl; httpClose(false); // Always close connection. @@ -1266,7 +1266,7 @@ void HTTPProtocol::copy( const KUrl& src, const KUrl& dest, int, bool overwrite ) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::copy " << src.prettyUrl() + kDebug() << "(" << m_pid << ") HTTPProtocol::copy " << src.prettyUrl() << " -> " << dest.prettyUrl() << endl; if ( !checkRequestUrl( dest ) || !checkRequestUrl( src ) ) @@ -1298,7 +1298,7 @@ void HTTPProtocol::rename( const KUrl& src, const KUrl& dest, bool overwrite ) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::rename " << src.prettyUrl() + kDebug() << "(" << m_pid << ") HTTPProtocol::rename " << src.prettyUrl() << " -> " << dest.prettyUrl() << endl; if ( !checkRequestUrl( dest ) || !checkRequestUrl( src ) ) @@ -1329,7 +1329,7 @@ void HTTPProtocol::del( const KUrl& url, bool ) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::del " << url.prettyUrl() + kDebug() << "(" << m_pid << ") HTTPProtocol::del " << url.prettyUrl() << endl; if ( !checkRequestUrl( url ) ) @@ -1353,7 +1353,7 @@ void HTTPProtocol::post( const KUrl& url ) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::post " + kDebug() << "(" << m_pid << ") HTTPProtocol::post " << url.prettyUrl() << endl; if ( !checkRequestUrl( url ) ) @@ -1371,7 +1371,7 @@ void HTTPProtocol::davLock( const KUrl& url, const QString& scope, const QString& type, const QString& owner ) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::davLock " + kDebug() << "(" << m_pid << ") HTTPProtocol::davLock " << url.prettyUrl() << endl; if ( !checkRequestUrl( url ) ) @@ -1436,7 +1436,7 @@ void HTTPProtocol::davUnlock( const KUrl& url ) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::davUnlock " + kDebug() << "(" << m_pid << ") HTTPProtocol::davUnlock " << url.prettyUrl() << endl; if ( !checkRequestUrl( url ) ) @@ -1732,10 +1732,10 @@ if ( reply.isValid() ) { int result = reply; - kDebug(7113) << "(" << m_pid << ") networkstatus status = " << result << endl; + kDebug() << "(" << m_pid << ") networkstatus status = " << result << endl; return (result != NetWorkStatusUnknown) && (result != NetWorkStatusOnline); } - kDebug(7113) << "(" << m_pid << ") networkstatus " << endl; + kDebug() << "(" << m_pid << ") networkstatus " << endl; return false; // On error, assume we are online } @@ -1745,7 +1745,7 @@ quint32 n; stream >> n; - kDebug(7113) << "(" << m_pid << ") HTTPProtcool::multiGet n = " << n << endl; + kDebug() << "(" << m_pid << ") HTTPProtcool::multiGet n = " << n << endl; HTTPRequest saveRequest; if (m_bBusy) @@ -1760,7 +1760,7 @@ if ( !checkRequestUrl( url ) ) continue; - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::multi_get " << url.url() << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::multi_get " << url.url() << endl; m_request.method = HTTP_GET; m_request.path = url.path(); @@ -1924,7 +1924,7 @@ void HTTPProtocol::httpCheckConnection() { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::httpCheckConnection: " << + kDebug() << "(" << m_pid << ") HTTPProtocol::httpCheckConnection: " << // " Socket status: " << m_iSock << " Keep Alive: " << m_bKeepAlive << " First: " << m_bFirstRequest << endl; @@ -1934,7 +1934,7 @@ bool closeDown = false; if ( !isConnectionValid()) { - kDebug(7113) << "(" << m_pid << ") Connection lost!" << endl; + kDebug() << "(" << m_pid << ") Connection lost!" << endl; closeDown = true; } else if ( m_request.method != HTTP_GET ) @@ -1974,7 +1974,7 @@ int errCode; QString errMsg; - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::httpOpenConnection" << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::httpOpenConnection" << endl; setBlockConnection( true ); @@ -1983,7 +1983,7 @@ QString proxy_host = m_proxyURL.host(); int proxy_port = m_proxyURL.port(); - kDebug(7113) << "(" << m_pid << ") Connecting to proxy server: " + kDebug() << "(" << m_pid << ") Connecting to proxy server: " << proxy_host << ", port: " << proxy_port << endl; infoMessage( i18n("Connecting to %1...", m_state.hostname) ); @@ -2085,7 +2085,7 @@ */ bool HTTPProtocol::httpOpen() { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::httpOpen" << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::httpOpen" << endl; // Cannot have an https request without the m_bIsSSL being set! This can // only happen if TCPSlaveBase::InitializeSSL() function failed in which it @@ -2218,7 +2218,7 @@ davHeader = "Depth: "; if ( hasMetaData( "davDepth" ) ) { - kDebug(7113) << "Reading DAV depth from metadata: " << metaData( "davDepth" ) << endl; + kDebug() << "Reading DAV depth from metadata: " << metaData( "davDepth" ) << endl; davHeader += metaData( "davDepth" ); } else @@ -2354,7 +2354,7 @@ if ( m_request.offset > 0 ) { header += QString("Range: bytes=%1-\r\n").arg(KIO::number(m_request.offset)); - kDebug(7103) << "kio_http : Range = " << KIO::number(m_request.offset) << endl; + kDebug() << "kio_http : Range = " << KIO::number(m_request.offset) << endl; } if ( m_request.cache == CC_Reload ) @@ -2428,9 +2428,10 @@ header += "\r\n"; } - if (m_request.method == HTTP_POST) + QString contentType = metaData("content-type"); + if (m_request.method == HTTP_POST && !contentType.isEmpty() ) { - header += metaData("content-type"); + header += contentType; header += "\r\n"; } @@ -2439,7 +2440,7 @@ // no caching for Negotiate auth. if ( !m_request.bNoAuth && m_responseCode != 401 && m_responseCode != 407 && Authentication != AUTH_Negotiate ) { - kDebug(7113) << "(" << m_pid << ") Calling checkCachedAuthentication " << endl; + kDebug() << "(" << m_pid << ") Calling checkCachedAuthentication " << endl; AuthInfo info; info.url = m_request.url; info.verifyPath = true; @@ -2457,7 +2458,7 @@ } else { - kDebug(7113) << "(" << m_pid << ") Not calling checkCachedAuthentication " << endl; + kDebug() << "(" << m_pid << ") Not calling checkCachedAuthentication " << endl; } switch ( Authentication ) @@ -2484,13 +2485,13 @@ /********* Only for debugging purpose *********/ if ( Authentication != AUTH_None ) { - kDebug(7113) << "(" << m_pid << ") Using Authentication: " << endl; - kDebug(7113) << "(" << m_pid << ") HOST= " << m_state.hostname << endl; - kDebug(7113) << "(" << m_pid << ") PORT= " << m_state.port << endl; - kDebug(7113) << "(" << m_pid << ") USER= " << m_state.user << endl; - kDebug(7113) << "(" << m_pid << ") PASSWORD= [protected]" << endl; - kDebug(7113) << "(" << m_pid << ") REALM= " << m_strRealm << endl; - kDebug(7113) << "(" << m_pid << ") EXTRA= " << m_strAuthorization << endl; + kDebug() << "(" << m_pid << ") Using Authentication: " << endl; + kDebug() << "(" << m_pid << ") HOST= " << m_state.hostname << endl; + kDebug() << "(" << m_pid << ") PORT= " << m_state.port << endl; + kDebug() << "(" << m_pid << ") USER= " << m_state.user << endl; + kDebug() << "(" << m_pid << ") PASSWORD= [protected]" << endl; + kDebug() << "(" << m_pid << ") REALM= " << m_strRealm << endl; + kDebug() << "(" << m_pid << ") EXTRA= " << m_strAuthorization << endl; } // Do we need to authorize to the proxy server ? @@ -2521,16 +2522,16 @@ } } - kDebug(7103) << "(" << m_pid << ") ============ Sending Header:" << endl; + kDebug() << "(" << m_pid << ") ============ Sending Header:" << endl; QStringList headerOutput = header.split("\r\n", QString::SkipEmptyParts); QStringList::Iterator it = headerOutput.begin(); for (; it != headerOutput.end(); ++it) - kDebug(7103) << "(" << m_pid << ") " << (*it) << endl; + kDebug() << "(" << m_pid << ") " << (*it) << endl; - if ( !moreData && !davData) - header += "\r\n"; /* end header */ + if ( !moreData && !davData ) + header += "\r\n"; /* end header */ // Now that we have our formatted header, let's send it! // Create a new connection to the remote machine if we do @@ -2539,7 +2540,7 @@ { if (!httpOpenConnection()) { - kDebug(7113) << "Couldn't connect, oopsie!" << endl; + kDebug() << "Couldn't connect, oopsie!" << endl; return false; } } @@ -2548,7 +2549,7 @@ bool sendOk = (write(header.toLatin1(), header.length()) == (ssize_t) header.length()); if (!sendOk) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::httpOpen: " + kDebug() << "(" << m_pid << ") HTTPProtocol::httpOpen: " "Connection broken! (" << m_state.hostname << ")" << endl; // With a Keep-Alive connection this can happen. @@ -2561,14 +2562,14 @@ if (!sendOk) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::httpOpen: sendOk==false." + kDebug() << "(" << m_pid << ") HTTPProtocol::httpOpen: sendOk==false." " Connnection broken !" << endl; error( ERR_CONNECTION_BROKEN, m_state.hostname ); return false; } } else - kDebug(7113) << "sent it!" << endl; + kDebug() << "sent it!" << endl; bool res = true; @@ -2600,7 +2601,7 @@ bool HTTPProtocol::readHeader() { try_again: - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::readHeader" << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::readHeader" << endl; // Check if (m_request.bCachedRead) @@ -2611,7 +2612,7 @@ if (!gzgets(m_request.fcache, buffer, 4096) ) { // Error, delete cache entry - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::readHeader: " + kDebug() << "(" << m_pid << ") HTTPProtocol::readHeader: " << "Could not access cache to obtain mimetype!" << endl; error( ERR_CONNECTION_BROKEN, m_state.hostname ); return false; @@ -2619,13 +2620,13 @@ m_strMimeType = QString::fromUtf8( buffer).trimmed(); - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::readHeader: cached " + kDebug() << "(" << m_pid << ") HTTPProtocol::readHeader: cached " << "data mimetype: " << m_strMimeType << endl; if (!gzgets(m_request.fcache, buffer, 4096) ) { // Error, delete cache entry - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::readHeader: " + kDebug() << "(" << m_pid << ") HTTPProtocol::readHeader: " << "Could not access cached data! " << endl; error( ERR_CONNECTION_BROKEN, m_state.hostname ); return false; @@ -2682,7 +2683,7 @@ if ( !isConnectionValid() ) { - kDebug(7113) << "HTTPProtocol::readHeader: No connection." << endl; + kDebug() << "HTTPProtocol::readHeader: No connection." << endl; return false; // Restablish connection and try again } @@ -2699,7 +2700,7 @@ if (m_bEOF || *buffer == '\0') { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::readHeader: " + kDebug() << "(" << m_pid << ") HTTPProtocol::readHeader: " << "EOF while waiting for header start." << endl; if (m_bKeepAlive) // Try to reestablish connection. { @@ -2713,18 +2714,18 @@ // Some web-servers fail to respond properly to a HEAD request. // We compensate for their failure to properly implement the HTTP standard // by assuming that they will be sending html. - kDebug(7113) << "(" << m_pid << ") HTTPPreadHeader: HEAD -> returned " + kDebug() << "(" << m_pid << ") HTTPPreadHeader: HEAD -> returned " << "mimetype: " << DEFAULT_MIME_TYPE << endl; mimeType(QString::fromLatin1(DEFAULT_MIME_TYPE)); return true; } - kDebug(7113) << "HTTPProtocol::readHeader: Connection broken !" << endl; + kDebug() << "HTTPProtocol::readHeader: Connection broken !" << endl; error( ERR_CONNECTION_BROKEN, m_state.hostname ); return false; } - kDebug(7103) << "(" << m_pid << ") ============ Received Response:"<< endl; + kDebug() << "(" << m_pid << ") ============ Received Response:"<< endl; bool noHeader = true; HTTP_REV httpRev = HTTP_None; @@ -2741,7 +2742,7 @@ // if there was only a newline then continue if (!len) { - kDebug(7103) << "(" << m_pid << ") --empty--" << endl; + kDebug() << "(" << m_pid << ") --empty--" << endl; continue; } @@ -2753,7 +2754,7 @@ // top of the reponse... noHeader = false; - kDebug(7103) << "(" << m_pid << ") \"" << buffer << "\"" << endl; + kDebug() << "(" << m_pid << ") \"" << buffer << "\"" << endl; // Save broken servers from damnation!! char* buf = buffer; @@ -2765,7 +2766,7 @@ { // We get XML / HTTP without a proper header // put string back - kDebug(7103) << "kio_http: No valid HTTP header found! Document starts with XML/HTML tag" << endl; + kDebug() << "kio_http: No valid HTTP header found! Document starts with XML/HTML tag" << endl; // Document starts with a tag, assume html instead of text/plain m_strMimeType = "text/html"; @@ -3023,7 +3024,7 @@ // Assign the mime-type. m_strMimeType = QString::fromLatin1(start, pos-start).trimmed().toLower(); - kDebug(7113) << "(" << m_pid << ") Content-type: " << m_strMimeType << endl; + kDebug() << "(" << m_pid << ") Content-type: " << m_strMimeType << endl; // If we still have text, then it means we have a mime-type with a // parameter (eg: charset=iso-8851) ; so let's get that... @@ -3212,7 +3213,7 @@ if( pos > -1 ) disposition = disposition.mid(pos+1); - kDebug(7113) << "(" << m_pid << ") Content-Disposition: " + kDebug() << "(" << m_pid << ") Content-Disposition: " << disposition<< endl; } } @@ -3544,10 +3545,10 @@ sendMetaData(); } - kDebug(7113) << "(" << m_pid << ") request.url: " << m_request.url.url() + kDebug() << "(" << m_pid << ") request.url: " << m_request.url.url() << endl << "LocationStr: " << locationStr.data() << endl; - kDebug(7113) << "(" << m_pid << ") Requesting redirection to: " << u.url() + kDebug() << "(" << m_pid << ") Requesting redirection to: " << u.url() << endl; // If we're redirected to a http:// url, remember that we're doing webdav... @@ -3688,7 +3689,7 @@ if( !disposition.isEmpty() ) { - kDebug(7113) << "(" << m_pid << ") Setting Content-Disposition metadata to: " + kDebug() << "(" << m_pid << ") Setting Content-Disposition metadata to: " << disposition << endl; setMetaData("content-disposition", disposition); } @@ -3715,7 +3716,7 @@ if (locationStr.isEmpty() && (!m_strMimeType.isEmpty() || m_request.method == HTTP_HEAD)) { - kDebug(7113) << "(" << m_pid << ") Emitting mimetype " << m_strMimeType << endl; + kDebug() << "(" << m_pid << ") Emitting mimetype " << m_strMimeType << endl; mimeType( m_strMimeType ); } @@ -3735,7 +3736,7 @@ if (!m_request.fcache) { m_request.bCachedWrite = false; // Error creating cache entry. - kDebug(7113) << "(" << m_pid << ") Error creating cache entry for " << m_request.url.url()<<"!\n"; + kDebug() << "(" << m_pid << ") Error creating cache entry for " << m_request.url.url()<<"!\n"; } m_request.expireDate = expireDate; m_maxCacheSize = config()->readEntry("MaxCacheSize", DEFAULT_MAX_CACHE_SIZE) / 2; @@ -3743,11 +3744,11 @@ } if (m_request.bCachedWrite && !m_strMimeType.isEmpty()) - kDebug(7113) << "(" << m_pid << ") Cache, adding \"" << m_request.url.url() << "\"" << endl; + kDebug() << "(" << m_pid << ") Cache, adding \"" << m_request.url.url() << "\"" << endl; else if (m_request.bCachedWrite && m_strMimeType.isEmpty()) - kDebug(7113) << "(" << m_pid << ") Cache, pending \"" << m_request.url.url() << "\"" << endl; + kDebug() << "(" << m_pid << ") Cache, pending \"" << m_request.url.url() << "\"" << endl; else - kDebug(7113) << "(" << m_pid << ") Cache, not adding \"" << m_request.url.url() << "\"" << endl; + kDebug() << "(" << m_pid << ") Cache, not adding \"" << m_request.url.url() << "\"" << endl; return true; } @@ -3773,7 +3774,7 @@ } else if ((encoding == "x-deflate") || (encoding == "deflate")) { encs.append(QString::fromLatin1("deflate")); } else { - kDebug(7113) << "(" << m_pid << ") Unknown encoding encountered. " + kDebug() << "(" << m_pid << ") Unknown encoding encountered. " << "Please write code. Encoding = \"" << encoding << "\"" << endl; } @@ -3789,16 +3790,16 @@ // m_bufPOST will NOT be empty iff authentication was required before posting // the data OR a re-connect is requested from ::readHeader because the // connection was lost for some reason. - if ( !m_bufPOST.isNull() ) + if ( !m_bufPOST.isEmpty() ) { - kDebug(7113) << "(" << m_pid << ") POST'ing saved data..." << endl; + kDebug() << "(" << m_pid << ") POST'ing saved data..." << endl; result = 0; length = m_bufPOST.size(); } else { - kDebug(7113) << "(" << m_pid << ") POST'ing live data..." << endl; + kDebug() << "(" << m_pid << ") POST'ing live data..." << endl; QByteArray buffer; int old_size; @@ -3828,24 +3829,24 @@ infoMessage( i18n( "Sending data to %1" , m_request.hostname ) ); QString size = QString ("Content-Length: %1\r\n\r\n").arg(length); - kDebug( 7113 ) << "(" << m_pid << ")" << size << endl; + kDebug() << "(" << m_pid << ")" << size << endl; // Send the content length... bool sendOk = (write(size.toLatin1(), size.length()) == (ssize_t) size.length()); if (!sendOk) { - kDebug( 7113 ) << "(" << m_pid << ") Connection broken when sending " + kDebug() << "(" << m_pid << ") Connection broken when sending " << "content length: (" << m_state.hostname << ")" << endl; error( ERR_CONNECTION_BROKEN, m_state.hostname ); return false; } // Send the data... - // kDebug( 7113 ) << "(" << m_pid << ") POST DATA: " << QCString(m_bufPOST) << endl; + // kDebug() << "(" << m_pid << ") POST DATA: " << QCString(m_bufPOST) << endl; sendOk = (write(m_bufPOST.data(), m_bufPOST.size()) == (ssize_t) m_bufPOST.size()); if (!sendOk) { - kDebug(7113) << "(" << m_pid << ") Connection broken when sending message body: (" + kDebug() << "(" << m_pid << ") Connection broken when sending message body: (" << m_state.hostname << ")" << endl; error( ERR_CONNECTION_BROKEN, m_state.hostname ); return false; @@ -3856,7 +3857,7 @@ void HTTPProtocol::httpClose( bool keepAlive ) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::httpClose" << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::httpClose" << endl; if (m_request.fcache) { @@ -3881,7 +3882,7 @@ else if (m_keepAliveTimeout > 2*DEFAULT_KEEP_ALIVE_TIMEOUT) m_keepAliveTimeout = 2*DEFAULT_KEEP_ALIVE_TIMEOUT; - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::httpClose: keep alive (" << m_keepAliveTimeout << ")" << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::httpClose: keep alive (" << m_keepAliveTimeout << ")" << endl; QByteArray data; QDataStream stream( &data, QIODevice::WriteOnly ); stream << int(99); // special: Close connection @@ -3894,13 +3895,13 @@ void HTTPProtocol::closeConnection() { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::closeConnection" << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::closeConnection" << endl; httpCloseConnection (); } void HTTPProtocol::httpCloseConnection () { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::httpCloseConnection" << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::httpCloseConnection" << endl; m_bIsTunneled = false; m_bKeepAlive = false; closeDescriptor(); @@ -3909,7 +3910,7 @@ void HTTPProtocol::slave_status() { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::slave_status" << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::slave_status" << endl; if ( !isConnectionValid() ) httpCloseConnection(); @@ -3919,7 +3920,7 @@ void HTTPProtocol::mimetype( const KUrl& url ) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::mimetype: " + kDebug() << "(" << m_pid << ") HTTPProtocol::mimetype: " << url.prettyUrl() << endl; if ( !checkRequestUrl( url ) ) @@ -3933,13 +3934,13 @@ retrieveHeader(); - kDebug(7113) << "(" << m_pid << ") http: mimetype = " << m_strMimeType + kDebug() << "(" << m_pid << ") http: mimetype = " << m_strMimeType << endl; } void HTTPProtocol::special( const QByteArray &data ) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::special" << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::special" << endl; int tmp; QDataStream stream(data); @@ -4010,7 +4011,7 @@ if (!gets(m_bufReceive.data(), m_bufReceive.size())) { - kDebug(7113) << "(" << m_pid << ") gets() failure on Chunk header" << endl; + kDebug() << "(" << m_pid << ") gets() failure on Chunk header" << endl; return -1; } // We could have got the CRLF of the previous chunk. @@ -4019,25 +4020,25 @@ { if (!gets(m_bufReceive.data(), m_bufReceive.size())) { - kDebug(7113) << "(" << m_pid << ") gets() failure on Chunk header" << endl; + kDebug() << "(" << m_pid << ") gets() failure on Chunk header" << endl; return -1; } } if (m_bEOF) { - kDebug(7113) << "(" << m_pid << ") EOF on Chunk header" << endl; + kDebug() << "(" << m_pid << ") EOF on Chunk header" << endl; return -1; } long long trunkSize = STRTOLL(m_bufReceive.data(), 0, 16); if (trunkSize < 0) { - kDebug(7113) << "(" << m_pid << ") Negative chunk size" << endl; + kDebug() << "(" << m_pid << ") Negative chunk size" << endl; return -1; } m_iBytesLeft = trunkSize; - // kDebug(7113) << "(" << m_pid << ") Chunk size = " << m_iBytesLeft << " bytes" << endl; + // kDebug() << "(" << m_pid << ") Chunk size = " << m_iBytesLeft << " bytes" << endl; if (m_iBytesLeft == 0) { @@ -4047,10 +4048,10 @@ // Skip trailer of last chunk. if (!gets(m_bufReceive.data(), m_bufReceive.size())) { - kDebug(7113) << "(" << m_pid << ") gets() failure on Chunk trailer" << endl; + kDebug() << "(" << m_pid << ") gets() failure on Chunk trailer" << endl; return -1; } - // kDebug(7113) << "(" << m_pid << ") Chunk trailer = \"" << m_bufReceive.data() << "\"" << endl; + // kDebug() << "(" << m_pid << ") Chunk trailer = \"" << m_bufReceive.data() << "\"" << endl; } while (strlen(m_bufReceive.data()) != 0); @@ -4092,7 +4093,7 @@ { if (m_bKeepAlive) { - kDebug(7113) << "(" << m_pid << ") Unbounded datastream on a Keep " + kDebug() << "(" << m_pid << ") Unbounded datastream on a Keep " << "alive connection!" << endl; m_bKeepAlive = false; } @@ -4133,7 +4134,7 @@ if ( m_strMimeType.isEmpty() && !m_bRedirect && !( m_responseCode >= 300 && m_responseCode <=399) ) { - kDebug(7113) << "(" << m_pid << ") Determining mime-type from content..." << endl; + kDebug() << "(" << m_pid << ") Determining mime-type from content..." << endl; int old_size = m_mimeTypeBuffer.size(); m_mimeTypeBuffer.resize( old_size + d.size() ); memcpy( m_mimeTypeBuffer.data() + old_size, d.data(), d.size() ); @@ -4144,21 +4145,21 @@ return; // Do not send up the data since we do not yet know its mimetype! } - kDebug(7113) << "(" << m_pid << ") Mimetype buffer size: " << m_mimeTypeBuffer.size() + kDebug() << "(" << m_pid << ") Mimetype buffer size: " << m_mimeTypeBuffer.size() << endl; KMimeType::Ptr mime = KMimeType::findByNameAndContent(m_request.url.fileName(), m_mimeTypeBuffer); if( mime && !mime->isDefault() ) { m_strMimeType = mime->name(); - kDebug(7113) << "(" << m_pid << ") Mimetype from content: " + kDebug() << "(" << m_pid << ") Mimetype from content: " << m_strMimeType << endl; } if ( m_strMimeType.isEmpty() ) { m_strMimeType = QString::fromLatin1( DEFAULT_MIME_TYPE ); - kDebug(7113) << "(" << m_pid << ") Using default mimetype: " + kDebug() << "(" << m_pid << ") Using default mimetype: " << m_strMimeType << endl; } @@ -4245,7 +4246,7 @@ if (m_request.bCachedRead) { - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::readBody: read data from cache!" << endl; + kDebug() << "(" << m_pid << ") HTTPProtocol::readBody: read data from cache!" << endl; m_request.bCachedWrite = false; char buffer[ MAX_IPC_SIZE ]; @@ -4287,7 +4288,7 @@ if (m_bChunked) m_iBytesLeft = NO_SIZE; - kDebug(7113) << "(" << m_pid << ") HTTPProtocol::readBody: retrieve data. "<>10 > m_maxCacheSize ) { - kDebug(7113) << "writeCacheEntry: File size reaches " << (m_request.bytesCached>>10) + kDebug() << "writeCacheEntry: File size reaches " << (m_request.bytesCached>>10) << "Kb, exceeds cache limits. (" << m_maxCacheSize << "Kb)" << endl; gzclose(m_request.fcache); m_request.fcache = 0; @@ -4955,22 +4956,22 @@ // scheme is received. This check accomplishes just that... if ( m_iProxyAuthCount == 0) ProxyAuthentication = f; - kDebug(7113) << "(" << m_pid << ") Rejected proxy auth method: " << f << endl; + kDebug() << "(" << m_pid << ") Rejected proxy auth method: " << f << endl; return; } m_iProxyAuthCount++; - kDebug(7113) << "(" << m_pid << ") Accepted proxy auth method: " << f << endl; + kDebug() << "(" << m_pid << ") Accepted proxy auth method: " << f << endl; } else { if ((f == AUTH_None) || ((m_iWWWAuthCount > 0) && (f < Authentication))) { - kDebug(7113) << "(" << m_pid << ") Rejected auth method: " << f << endl; + kDebug() << "(" << m_pid << ") Rejected auth method: " << f << endl; return; } m_iWWWAuthCount++; - kDebug(7113) << "(" << m_pid << ") Accepted auth method: " << f << endl; + kDebug() << "(" << m_pid << ") Accepted auth method: " << f << endl; } @@ -5115,7 +5116,7 @@ if ( pos < len && auth.indexOf("true", pos, Qt::CaseInsensitive) != -1 ) { isStaleNonce = true; - kDebug(7113) << "(" << m_pid << ") Stale nonce value. " + kDebug() << "(" << m_pid << ") Stale nonce value. " << "Will retry using same info..." << endl; } } @@ -5143,12 +5144,12 @@ if ( Authentication == AUTH_NTLM || ProxyAuthentication == AUTH_NTLM ) { QString auth = ( m_responseCode == 401 ) ? m_strAuthorization : m_strProxyAuthorization; - kDebug(7113) << "auth: " << auth << endl; + kDebug() << "auth: " << auth << endl; if ( auth.length() > 4 ) { prompt = false; result = true; - kDebug(7113) << "(" << m_pid << ") NTLM auth second phase, " + kDebug() << "(" << m_pid << ") NTLM auth second phase, " << "sending response..." << endl; if ( m_responseCode == 401 ) { @@ -5240,7 +5241,7 @@ if ( pos < len && auth.indexOf("true", pos, Qt::CaseInsensitive) != -1 ) { info.digestInfo = (m_responseCode == 401) ? m_strAuthorization : m_strProxyAuthorization; - kDebug(7113) << "(" << m_pid << ") Just a stale nonce value! " + kDebug() << "(" << m_pid << ") Just a stale nonce value! " << "Retrying using the new nonce sent..." << endl; } } @@ -5265,7 +5266,7 @@ } else if ( m_request.disablePassDlg == false ) { - kDebug( 7113 ) << "(" << m_pid << ") Prompting the user for authorization..." << endl; + kDebug() << "(" << m_pid << ") Prompting the user for authorization..." << endl; promptInfo( info ); result = openPasswordDialog( info, errorMsg ); } @@ -5375,13 +5376,13 @@ // see whether we can use the SPNEGO mechanism major_status = gss_indicate_mechs(&minor_status, &mech_set); if (GSS_ERROR(major_status)) { - kDebug(7113) << "(" << m_pid << ") gss_indicate_mechs failed: " << gssError(major_status, minor_status) << endl; + kDebug() << "(" << m_pid << ") gss_indicate_mechs failed: " << gssError(major_status, minor_status) << endl; } else { for (i=0; icount && !found; i++) { tmp_oid = &mech_set->elements[i]; if (tmp_oid->length == spnego_oid_desc.length && !memcmp(tmp_oid->elements, spnego_oid_desc.elements, tmp_oid->length)) { - kDebug(7113) << "(" << m_pid << ") createNegotiateAuth: found SPNEGO mech" << endl; + kDebug() << "(" << m_pid << ") createNegotiateAuth: found SPNEGO mech" << endl; found = 1; mech_oid = &spnego_oid_desc; break; @@ -5404,7 +5405,7 @@ input_token.length = 0; if (GSS_ERROR(major_status)) { - kDebug(7113) << "(" << m_pid << ") gss_import_name failed: " << gssError(major_status, minor_status) << endl; + kDebug() << "(" << m_pid << ") gss_import_name failed: " << gssError(major_status, minor_status) << endl; // reset the auth string so that subsequent methods aren't confused m_strAuthorization.clear(); return QString(); @@ -5419,7 +5420,7 @@ if (GSS_ERROR(major_status) || (output_token.length == 0)) { - kDebug(7113) << "(" << m_pid << ") gss_init_sec_context failed: " << gssError(major_status, minor_status) << endl; + kDebug() << "(" << m_pid << ") gss_init_sec_context failed: " << gssError(major_status, minor_status) << endl; gss_release_name(&minor_status, &server); if (ctx != GSS_C_NO_CONTEXT) { gss_delete_sec_context(&minor_status, &ctx, GSS_C_NO_BUFFER); @@ -5487,7 +5488,7 @@ user = user.section( '\\', 1 ); } - kDebug(7113) << "(" << m_pid << ") NTLM length: " << len << endl; + kDebug() << "(" << m_pid << ") NTLM length: " << len << endl; if ( user.isEmpty() || passwd.isEmpty() || len < 4 ) return QString(); @@ -5572,7 +5573,7 @@ } HA1 = md.hexDigest(); - kDebug(7113) << "(" << m_pid << ") calculateResponse(): A1 => " << HA1 << endl; + kDebug() << "(" << m_pid << ") calculateResponse(): A1 => " << HA1 << endl; // Calcualte H(A2) authStr = info.method; @@ -5587,7 +5588,7 @@ md.update( authStr ); HA2 = md.hexDigest(); - kDebug(7113) << "(" << m_pid << ") calculateResponse(): A2 => " + kDebug() << "(" << m_pid << ") calculateResponse(): A2 => " << HA2 << endl; // Calcualte the response. @@ -5609,7 +5610,7 @@ md.update( authStr ); Response = md.hexDigest(); - kDebug(7113) << "(" << m_pid << ") calculateResponse(): Response => " + kDebug() << "(" << m_pid << ") calculateResponse(): Response => " << Response << endl; } @@ -5831,19 +5832,19 @@ break; } - kDebug(7113) << "(" << m_pid << ") createDigestAuth(): passed digest " + kDebug() << "(" << m_pid << ") createDigestAuth(): passed digest " "authentication credential test: " << send << endl; if (!send) return QString(); } - kDebug(7113) << "(" << m_pid << ") RESULT OF PARSING:" << endl; - kDebug(7113) << "(" << m_pid << ") algorithm: " << info.algorithm << endl; - kDebug(7113) << "(" << m_pid << ") realm: " << info.realm << endl; - kDebug(7113) << "(" << m_pid << ") nonce: " << info.nonce << endl; - kDebug(7113) << "(" << m_pid << ") opaque: " << opaque << endl; - kDebug(7113) << "(" << m_pid << ") qop: " << info.qop << endl; + kDebug() << "(" << m_pid << ") RESULT OF PARSING:" << endl; + kDebug() << "(" << m_pid << ") algorithm: " << info.algorithm << endl; + kDebug() << "(" << m_pid << ") realm: " << info.realm << endl; + kDebug() << "(" << m_pid << ") nonce: " << info.nonce << endl; + kDebug() << "(" << m_pid << ") opaque: " << opaque << endl; + kDebug() << "(" << m_pid << ") qop: " << info.qop << endl; // Calculate the response... calculateResponse( info, Response ); @@ -5941,13 +5942,13 @@ /********* Only for debugging purpose... *********/ if ( ProxyAuthentication != AUTH_None ) { - kDebug(7113) << "(" << m_pid << ") Using Proxy Authentication: " << endl; - kDebug(7113) << "(" << m_pid << ") HOST= " << m_proxyURL.host() << endl; - kDebug(7113) << "(" << m_pid << ") PORT= " << m_proxyURL.port() << endl; - kDebug(7113) << "(" << m_pid << ") USER= " << m_proxyURL.user() << endl; - kDebug(7113) << "(" << m_pid << ") PASSWORD= [protected]" << endl; - kDebug(7113) << "(" << m_pid << ") REALM= " << m_strProxyRealm << endl; - kDebug(7113) << "(" << m_pid << ") EXTRA= " << m_strProxyAuthorization << endl; + kDebug() << "(" << m_pid << ") Using Proxy Authentication: " << endl; + kDebug() << "(" << m_pid << ") HOST= " << m_proxyURL.host() << endl; + kDebug() << "(" << m_pid << ") PORT= " << m_proxyURL.port() << endl; + kDebug() << "(" << m_pid << ") USER= " << m_proxyURL.user() << endl; + kDebug() << "(" << m_pid << ") PASSWORD= [protected]" << endl; + kDebug() << "(" << m_pid << ") REALM= " << m_strProxyRealm << endl; + kDebug() << "(" << m_pid << ") EXTRA= " << m_strProxyAuthorization << endl; } switch ( ProxyAuthentication ) --Boundary-00=_ceuoGJFnzpD94KS--