Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.4.1

Bug #3116 HTTP response message does not contain CRLF
Submitted: 2005-01-05 19:39 UTC
From: vincent at dauphin-mm dot nl Assigned: cweiske
Status: Closed Package: HTTP_Server
PHP Version: 4.3.9 OS: linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 33 - 10 = ?

 
 [2005-01-05 19:39 UTC] vincent at dauphin-mm dot nl
Description: ------------ The function _sendResponse() in class HTTP_Server generates a response where the status-line and headers don't end with CRLF, but only with LF. This can be fix with the following patch: --- Server.php.orig 2005-01-05 20:38:47.100824286 +0100 +++ Server.php 2005-01-05 20:37:10.018097924 +0100 @@ -265,7 +265,7 @@ $response["code_translated"] = $this->_resolveStatusCode($response["code"]); // send the response code - $this->_driver->sendData($clientId, sprintf("HTTP/1.0 %s %s\n", $response["code"], $response["code_translated"])); + $this->_driver->sendData($clientId, sprintf("HTTP/1.0 %s %s\r\n", $response["code"], $response["code_translated"])); // check for headers if (!isset($response["headers"]) || (!is_array($response["headers"])) ) { @@ -288,13 +288,13 @@ // send the headers foreach($response["headers"] as $header => $value) { - $this->_driver->sendData($clientId, sprintf("%s: %s\n", $header, $value)); + $this->_driver->sendData($clientId, sprintf("%s: %s\r\n", $header, $value)); } // send the response body if (isset($response["body"])) { - $this->_driver->sendData($clientId, "\n"); + $this->_driver->sendData($clientId, "\r\n"); if (is_string($response["body"])) { $this->_driver->sendData($clientId, $response["body"]); }

Comments

 [2005-01-29 18:42 UTC] cweiske
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.