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
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.