Bug #79575 [Ver]: Content-Length header name is getting corrupted
| From: | cmb@php.net | Date: | Mon, 11 May 2020 08:56:52 +0000 |
| Subject: | Bug #79575 [Ver]: Content-Length header name is getting corrupted | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226990@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79575&edit=1
ID: 79575
Updated by: cmb@php.net
Reported by: kevin dot seymour at gmail dot com
Summary: Content-Length header name is getting corrupted
Status: Verified
Type: Bug
Package: OpenSSL related
Operating System: *
PHP Version: 7.3
Block user comment: N
Private report: N
New Comment:
I'm not sure whether we prepare SSL correctly for this case.
Previous Comments:
------------------------------------------------------------------------
[2020-05-11 08:00:11] nikic@php.net
This is pretty weird. If the corrupted output comes from SSL_read(), then I don't think the
problem here can be on the PHP side, right?
------------------------------------------------------------------------
[2020-05-09 13:32:50] cmb@php.net
Apparently, the respective SSL_read() call[1] yields the broken
contents.
[1] <https://github.com/php/php-src/blob/php-7.3.17/ext/openssl/xp_ssl.c#L2099>
------------------------------------------------------------------------
[2020-05-08 16:59:35] kevin dot seymour at gmail dot com
Description:
------------
When you run the below script you'll see the Content-Length header will come back with the
correct value, but that the word Content is jumbled. For example:
Cteonnt-Length: 195628.
If you change Accept-Encoding to identity (disable compression) the value comes back correctly.
This is causing unexpected end of data errors when we use SoapClient to attempt to parse a WSDL as
only part of the XML is returned.
There is a lot of testing information here:
https://stackoverflow.com/questions/61681804/php-file-get-contents-returning-inconsistent-partial-data-for-http-requests
Test script:
---------------
php << 'EOF'
<?php
$ctx = stream_context_create(array(
'http' => array(
'header' => "Accept-Encoding: gzip"
)
));
$xml = file_get_contents('https://webservices3.autotask.net/atservices/1.6/atws.wsdl',
false, $ctx);
echo var_dump($http_response_header);
?>
EOF
Expected result:
----------------
Content-Length should remain with the same header name.
Actual result:
--------------
Content-Length header field name is corrupted.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79575&edit=1