[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.3/kdelibs/kioslave/http
From:       Andreas Hartmetz <ahartmetz () gmail ! com>
Date:       2009-07-14 23:47:57
Message-ID: 1247615277.233046.29508.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 996832 by ahartmetz:

Apply dfaure's bugfix to send the mimetype exactly once (no more, no less). Also fix \
websites with authentication and connection:close - discarding and/or not reading the \
body didn't work as intended. The fixes don't fix some uglyness in the existing code, \
but that is really material for trunk.

 M  +11 -4     http.cpp  
 M  +1 -0      http.h  


--- branches/KDE/4.3/kdelibs/kioslave/http/http.cpp #996831:996832
@@ -1,4 +1,4 @@
-/*
+*/
    Copyright (C) 2000-2003 Waldo Bastian <bastian@kde.org>
    Copyright (C) 2000-2002 George Staikos <staikos@kde.org>
    Copyright (C) 2000-2002 Dawit Alemayehu <adawit@kde.org>
@@ -3373,10 +3373,12 @@
             }
         }
 
+        // read and trash body data until the next response header starts.
         if (m_request.isKeepAlive) {
-            // Important: trash data until the next response header starts.
             readBody(true);
         }
+        //### for now this is necessary, but we could really just close the \
connection right here. +        m_dataInternal = true;
     }
 
   // We need to do a redirect
@@ -3518,9 +3520,9 @@
   }
 
   // Let the app know about the mime-type iff this is not
-  // a redirection and the mime-type string is not empty.
+  // a redirection (or a 401/407 auth required) and the mime-type string is not \
empty.  if (locationStr.isEmpty() && (!m_mimeType.isEmpty() ||
-      m_request.method == HTTP_HEAD))
+      m_request.method == HTTP_HEAD) && !m_dataInternal)
   {
     kDebug(7113) << "Emitting mimetype " << m_mimeType;
     mimeType( m_mimeType );
@@ -4069,7 +4071,10 @@
           m_mimeType = QString::fromLatin1( DEFAULT_MIME_TYPE );
           kDebug(7113) << "Using default mimetype: " <<  m_mimeType;
         }
+      }
 
+      if (!m_mimeTypeSent && !m_mimeType.isEmpty())
+      {
         if ( m_request.cacheTag.writeToCache )
         {
           createCacheEntry( m_mimeType, m_request.cacheTag.expireDate );
@@ -4086,6 +4091,7 @@
         }
         mimeType(m_mimeType);
         m_mimeTypeBuffer.resize(0);
+        m_mimeTypeSent = true;
       }
 
       data( d );
@@ -4210,6 +4216,7 @@
 
   // Main incoming loop...  Gather everything while we can...
   m_cpMimeBuffer = false;
+  m_mimeTypeSent = false;
   m_mimeTypeBuffer.resize(0);
   struct timeval last_tv;
   gettimeofday( &last_tv, 0L );
--- branches/KDE/4.3/kdelibs/kioslave/http/http.h #996831:996832
@@ -486,6 +486,7 @@
 
   // Mimetype determination
   bool m_cpMimeBuffer;
+  bool m_mimeTypeSent;
   QByteArray m_mimeTypeBuffer;
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic