User-Agent field being ignored
Bug appears on the request, when the WSDL is not valid AND different from NULL
STEP 1: Fresh machine
Start with a fresh machine, no php, no apache installed.. clean
Step 2: Grab PHP 5.3.9
Downloaded from stable release
Extracted
Step 3: Configure and Compile with support for SOAP and SOCKETS (needed for testing)
./configure --enable-soap --enable-sockets
![]()


Step 4: Create socket to listen on port 80
Using command:
sudo sapi/cli/php -r '$s = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($s, "127.0.0.1", 80); socket_listen($s); while (($c = socket_accept($s)) != 0) { while($a = socket_read($c, 100)) { print $a; } }'
Socket listening is on left window
Step 5: Create SOAP client to try to grab WSDL from localhost
Using command:
sapi/cli/php -r '$s = new soapclient("http://localhost/", array("user_agent" => "le Agent specified")); $s->call("localhost", array());'
Socket listening is on left window, request created is on the right
Step 6: RESULTS
As you can see on the previous screen, even though the request failed and throws an exception (because it is not a Valid WSDL), the receiving end gets no User-Agent field set
Step 7: Patched version
With the patch, even though the request fails, receiving end gets the User-Agent field

CONSIDERATIONS DURING TESTING (IMPORTANT!):
I noticed that the listening socket seems to hang after a couple requests or idle time; and does not show incoming hits, so start and stop the listening process everytime you send a request to make sure it is working
If when you try to restart the listening socket and says that it cannot bind to that port, make sure to kill the previous or restart the machine if you cannot find it, otherwise it wont show any requests
Patch: https://bugs.php.net/patch-display.php?bug_id=60887&patch=Bug60887_user_agent_FIX_rfc2616_compliant&revision=latest
Any doubts/issues/comments: carloschilazo@gmail.com