ZF-3333: Do not close keep-alive connections when HTTP response code is 304 Not modified

Description

Currently connection is closed always when '304 Not modified' response is sent by server.

This patch prevents connection closing when this response is sent (this happens for example when If-Modified-Since header is used with request) and keep-alive is active.

This greatly speeds up checking if you have up-to-date files/data on servers with keep-alive enabled.

Patch:


--- old/Socket.php  2008-02-16 12:58:39.000000000 +0200
+++ new/Socket.php  2008-05-26 11:06:34.000000000 +0300
@@ -285,6 +285,9 @@
                 $response .= $chunk;
             }
 
+        } elseif (Zend_Http_Response::extractCode($response) == 304) {
+            return $response;
+        
         // Fallback: just read the response (should not happen)
         } else {
             while ($buff = @fread($this->socket, 8192)) {

Comments

Assigning. Shahar, if this change makes sense and is BC, can you please target it for 'Next Minor Release' with 'must have' priority?

Fixed in r. 9870. Does not break BC.

Updating for the 1.6.0 release.