|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-04-08 10:06 UTC] mike@php.net
[2015-04-08 10:06 UTC] mike@php.net
-Status: Open
+Status: Closed
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 21:00:01 2025 UTC |
Description: ------------ We have observed some new and unexpected behaviour with PUT requests since upgrading from 2.2 to 2.4.1. A PUT request which triggers a HTTP/1.1 100 Continue followed by a 200 OK returns 100 when getResponseCode() is called. I have supplied a fairly terrible server script below that returns exactly the same response structure as the server we're interacting with which is causing the problem for us. The request headers I see using both 2.2 and 2.4.1 are the same (apart from the version number in the UA, of course): PUT / HTTP/1.1 User-Agent: PECL_HTTP/2.4.1 PHP/5.6.7 libcurl/7.37.1 Host: localhost:8081 Accept: */* Content-Length: 3 Expect: 100-continue Using 2.2, the client script below shows a response code of 200. Using 2.4.1, it shows 100. Test script: --------------- if ($argv[1] == 'server') { $s = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_set_option($s, SOL_SOCKET, SO_REUSEADDR, 1); socket_bind($s, "127.0.0.1", 8081); socket_listen($s); while (true) { $c = socket_accept($s); $h = socket_read($c, 8192); echo $h; socket_write($c, "HTTP/1.1 100 Continue\r\n\r\n"); socket_write($c, implode("\r\n", [ "HTTP/1.1 200 OK", "Content-Length: 3", "Content-Type: text/plain", "", "foo", "", ])."\r\n"); socket_close($c); } socket_close($s); } elseif ($argv[1] == 'client') { $rq = new \Http\Client\Request('PUT', 'http://localhost:8081/', [], (new \Http\Message\Body)->append("foo") ); $c = new \Http\Client; $rs = $c->enqueue($rq)->send()->getResponse(); var_dump($rs->getResponseCode()); }