Bug #70470 [Opn]: Built-in server truncates headers spanning over TCP packets

From: Date: Fri, 11 Sep 2015 05:51:21 +0000
Subject: Bug #70470 [Opn]: Built-in server truncates headers spanning over TCP packets
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195953@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70470&edit=1 ID: 70470 Updated by: laruence@php.net Reported by: bwoebi@php.net Summary: Built-in server truncates headers spanning over TCP packets Status: Open Type: Bug Package: Built-in web server Operating System: Irrelevant PHP Version: 5.6.13 Block user comment: N Private report: N New Comment: actually, not only header_value, but also header name, I committed a test script here: https://github.com/php/php-src/commit/37d814b84cff3678a2e1d56ea9d3ba3c35082e13 however, I don't see a good fix in the current implementation now... :< thanks Previous Comments: ------------------------------------------------------------------------ [2015-09-10 19:03:31] bwoebi@php.net Description: ------------ The built-in server can truncate headers if they span over a TCP packet boundary. Internally, it uses MARK(header_value) (Sets header_value_mark to the current pointer), then upon reaching the \r\n (in the next packet then, same buffer), but the \r\n will end up being before the header_value_mark pointer, thus ending up of never reading the part before the \r\n in the second packet. Test script: --------------- Use a valid header and ensure it's send in two different TCP packets to built-in server. Begin sending a header value in one packet and finish it in another. Then dump the header value. Expected result: ---------------- Header value should be complete. Actual result: -------------- The header value is being truncated at the exact packet boundary. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70470&edit=1

« previous php.bugs (#195953) next »