<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>147812</bug_id>
          
          <creation_ts>2007-07-12 16:04:59 +0000</creation_ts>
          <short_desc>HTTP responses containing just a header cause Konqueror to wait indefinitely for a response</short_desc>
          <delta_ts>2007-09-01 21:14:51 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>Unmaintained</classification>
          <product>kio</product>
          <component>http</component>
          <version>unspecified</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Robert Hogan">robert</reporter>
          <assigned_to name="Unassigned bugs">unassigned-bugs-null</assigned_to>
          
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>535974</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Hogan">robert</who>
    <bug_when>2007-07-12 16:04:59 +0000</bug_when>
    <thetext>Version:            (using KDE KDE 3.5.7)
Installed from:    Compiled From Sources
Compiler:          gcc 
OS:                Linux

HTTP Responses along the lines of:

&quot;HTTP/1.0 503 Network Object Not Available\r\n\r\n&quot;

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&apos;t an error, first
     // kdDebug(7113) &lt;&lt; &quot;(&quot; &lt;&lt; (int) m_pid &lt;&lt; &quot;) readBody: bytesReceived: &quot;
     //              &lt;&lt; (int) bytesReceived &lt;&lt; &quot; m_iSize: &quot; &lt;&lt; (int) m_iSize &lt;&lt; &quot; Chunked: &quot;
     //              &lt;&lt; (int) m_bChunked &lt;&lt; &quot; BytesLeft: &quot;&lt;&lt; (int) m_iBytesLeft &lt;&lt; endl;
+
+    if (totalBytesReceived == 0){
+      if (m_responseCode &gt;= 500 &amp;&amp; m_responseCode &lt;= 599)
+        error(ERR_INTERNAL_SERVER, m_state.hostname);
+      else if (m_responseCode &gt;= 400 &amp;&amp; m_responseCode &lt;= 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)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>535976</commentid>
    <comment_count>1</comment_count>
    <who name="Robert Hogan">robert</who>
    <bug_when>2007-07-12 16:07:06 +0000</bug_when>
    <thetext>As a sidenote: Firefox, Opera and wget all handle http://moria.csail.mit.edu:9031/tor/status/rob gracefully.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>536163</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Rodrigues">phil</who>
    <bug_when>2007-07-13 22:36:07 +0000</bug_when>
    <thetext>Confirmed here</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>543987</commentid>
    <comment_count>3</comment_count>
    <who name="Dawit Alemayehu">adawit</who>
    <bug_when>2007-09-01 21:14:51 +0000</bug_when>
    <thetext>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 &lt;= 1)
+  {
+    if (m_responseCode &gt;= 500 &amp;&amp; m_responseCode &lt;= 599)
+      error(ERR_INTERNAL_SERVER, m_state.hostname);
+    else if (m_responseCode &gt;= 400 &amp;&amp; m_responseCode &lt;= 499)
+      error(ERR_DOES_NOT_EXIST, m_state.hostname);
+  }
+
   if (!dataInternal)
     data( QByteArray() );
   return true;
</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>