Edit report at https://bugs.php.net/bug.php?id=60887&edit=1
ID: 60887
Comment by: mail at tomsommer dot dk
Reported by: mail at tomsommer dot dk
Summary: SoapClient ignores user_agent option and sends no
User-Agent header
Status: Open
Type: Bug
Package: SOAP related
PHP Version: 5.3.9
Block user comment: N
Private report: N
New Comment:
I've tested it on several machines.
It's not a matter of stripping the header, since stream_context works.
My test script:
<?php
if ( isset($_GET['check']) ) {
mail('[email protected]', 'ff', print_r(apache_request_headers(), true));
} else {
$client = new SoapClient('http://example.com/soap.php?check=1',
array('user_agent' => 'foo'));
}
?>
Previous Comments:
------------------------------------------------------------------------
[2012-01-27 05:07:27] carloschilazo at gmail dot com
Forgot to mention, I tested with 5.3.9 realeased version, and also with the
current snapshot
------------------------------------------------------------------------
[2012-01-27 05:05:53] carloschilazo at gmail dot com
I could not reproduce your problem, using PHP 5.3.9 (linux) was able to send a
request with user_agent header set
I captured with WireShark.... could you please try to:
a) capture with another program (maybe)
b) make sure that on the other end , the user_agent is not being stripped
or provide more info
------------------------------------------------------------------------
[2012-01-26 07:16:20] mail at tomsommer dot dk
Workaround is:
$opts = array(
'http'=>array(
'user_agent' => 'foo'
)
);
$context = stream_context_create($opts);
$client = new SoapClient('http://www.example.com/', array('stream_context' =>
$context));
------------------------------------------------------------------------
[2012-01-25 20:55:06] mail at tomsommer dot dk
The receiving server only receive the following headers:
GET / HTTP/1.1
Host: www.example.com
Connection: close
Checked with tcpdump
------------------------------------------------------------------------
[2012-01-25 20:45:55] mail at tomsommer dot dk
Description:
------------
The SoapClient ignores the "user_agent" option, and sends no User-Agent at all.
Test script:
---------------
$client = new SoapClient('http://www.example.com/', array('user_agent' =>
'foo'));
Expected result:
----------------
User-Agent header on the remote server
Actual result:
--------------
No User-Agent header on the remote server
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60887&edit=1