Skip to content

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

Closed

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

Activity

  1. damianwadley commented on Aug 12, 2022

    @damianwadley
    Member

    Allowing more than 127 characters, like 255 is a nice round number, seems reasonable, but that status line is only supposed to have a short descriptive reason for the code. It is not the place for error messages. So tsk tsk, Microsoft.

  2. cmb69 commented on Aug 12, 2022

    @cmb69
    Member

    I have to agree that the reason-phrase is unnecessarily verbose, but to my knowledge there is no actual length restriction, so we should probably comply.

  3. self-assigned this
    on Aug 16, 2022
  4. added 3 commits that reference this issue on Aug 17, 2022
    ae1db2c
    72da418
    5d196d9
  5. added a commit that references this issue on Aug 18, 2022
    45a3f4c
  6. added 2 commits that reference this issue on Nov 22, 2023
    37f67a9
    e5b3e37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions