Skip to content

contents of $http_response_header is incorrect with long http message #9316

Closed
@fasterforward

Description

@fasterforward

Description

The following code:

echo file_get_contents('https://secret.blob.core.windows.net/container/documents/899/00000898942?si=secret&spr=https&sv=2021-06-08&sr=c&sig=secret');

print_r($http_response_header);

Resulted in this output:

Array
(
    [0] => HTTP/1.1 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly includ
    [1] => ing the signature.
    [2] => Content-Length: 544
    [3] => Content-Type: application/xml
    [4] => Server: Microsoft-HTTPAPI/2.0
    [5] => x-ms-request-id: 62435059-d01e-0017-2c51-aea046000000
    [6] => x-ms-error-code: AuthenticationFailed
    [7] => Date: Fri, 12 Aug 2022 13:45:53 GMT
    [8] => Connection: close
)

But I expected this output instead:

Array
(
    [0] => HTTP/1.1 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    [1] => Content-Length: 544
    [2] => Content-Type: application/xml
    [3] => Server: Microsoft-HTTPAPI/2.0
    [4] => x-ms-request-id: 62435059-d01e-0017-2c51-aea046000000
    [5] => x-ms-error-code: AuthenticationFailed
    [6] => Date: Fri, 12 Aug 2022 13:45:53 GMT
    [7] => Connection: close
)

Here are the raw response headers according to network tab of FireFox:

HTTP/1.1 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
Content-Length: 544
Content-Type: application/xml
Server: Microsoft-HTTPAPI/2.0
x-ms-request-id: d9fdcb88-f01e-0022-4551-ae0e13000000
x-ms-error-code: AuthenticationFailed
Date: Fri, 12 Aug 2022 13:42:57 GMT

PHP Version

PHP 8.1

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions