Version: (using KDE KDE 3.5.7) Installed from: Compiled From Sources Compiler: gcc OS: Linux HTTP Responses along the lines of: "HTTP/1.0 503 Network Object Not Available\r\n\r\n" with no body after the header cause Konqueror to wait indefinitely. This is because kio_http is expecting the error to be reported in a body element, e.g. an html-ized version of the error from Apache, and never gives anything back to the client. Try http://moria.csail.mit.edu:9031/tor/status/rob to see what I mean. When there is a zero-length body in a HTTP response, kio_http needs to report the http response code to the client. The following does this in HTTPProtocol::readBody() for the two likeliest which have a corresponding error() response in HTTPProtocol::readHeader(). It defaults to ERR_NO_CONTENT for all other cases, which may or may not be the right thing to do. Index: kdelibs/kioslave/http/http.cc =================================================================== --- kdelibs/kioslave/http/http.cc (revision 686951) +++ kdelibs/kioslave/http/http.cc (working copy) @@ -4443,6 +4443,8 @@ chain.addFilter(new HTTPFilterDeflate); } + int totalBytesReceived=0; + while (!m_bEOF) { int bytesReceived; @@ -4454,10 +4456,23 @@ else bytesReceived = readUnlimited(); + totalBytesReceived += bytesReceived; + // make sure that this wasn't an error, first // kdDebug(7113) << "(" << (int) m_pid << ") readBody: bytesReceived: " // << (int) bytesReceived << " m_iSize: " << (int) m_iSize << " Chunked: " // << (int) m_bChunked << " BytesLeft: "<< (int) m_iBytesLeft << endl; + + if (totalBytesReceived == 0){ + if (m_responseCode >= 500 && m_responseCode <= 599) + error(ERR_INTERNAL_SERVER, m_state.hostname); + else if (m_responseCode >= 400 && m_responseCode <= 499) + error(ERR_DOES_NOT_EXIST, m_state.hostname); + else + error(ERR_NO_CONTENT, m_state.hostname); + return false; + } + if (bytesReceived == -1) { if (m_iContentLeft == 0)
As a sidenote: Firefox, Opera and wget all handle http://moria.csail.mit.edu:9031/tor/status/rob gracefully.
Confirmed here
SVN commit 707403 by adawit: - Do not assume that the server will send error pages on 4xx and 5xx response. Fixes 147812. BUG:147812 M +8 -0 http.cpp --- trunk/KDE/kdelibs/kioslave/http/http.cpp #707402:707403 @@ -4399,6 +4399,14 @@ closeCacheEntry(); } + if (sz <= 1) + { + if (m_responseCode >= 500 && m_responseCode <= 599) + error(ERR_INTERNAL_SERVER, m_state.hostname); + else if (m_responseCode >= 400 && m_responseCode <= 499) + error(ERR_DOES_NOT_EXIST, m_state.hostname); + } + if (!dataInternal) data( QByteArray() ); return true;