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

Issue Type: Patch Created: 2008-05-27T00:28:21.000+0000 Last Updated: 2008-09-02T10:39:30.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Lenar Lohmus (flex) Assignee: Shahar Evron (shahar) Tags: - Zend_Http_Client

Related issues: - ZF-3548



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.


<pre class="highlight">
--- 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)) {


Posted by Wil Sinclair (wil) on 2008-06-01T15:18:29.000+0000

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

Posted by Shahar Evron (shahar) on 2008-07-02T00:30:24.000+0000

Fixed in r. 9870. Does not break BC.

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:30.000+0000

Updating for the 1.6.0 release.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.