Zend Framework

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

Details

  • Type: Patch Patch
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.5.2
  • Fix Version/s: 1.6.0
  • Component/s: Zend_Http_Client
  • Labels:
    None

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)) {

Issue Links

Activity

Hide
Wil Sinclair added a comment -

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

Show
Wil Sinclair added a comment - Assigning. Shahar, if this change makes sense and is BC, can you please target it for 'Next Minor Release' with 'must have' priority?
Hide
Shahar Evron added a comment -

Fixed in r. 9870. Does not break BC.

Show
Shahar Evron added a comment - Fixed in r. 9870. Does not break BC.
Hide
Wil Sinclair added a comment -

Updating for the 1.6.0 release.

Show
Wil Sinclair added a comment - Updating for the 1.6.0 release.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: