Skip to content
This repository has been archived by the owner on Oct 6, 2021. It is now read-only.

Incorrect protocol number at headers #161

Closed
emanuelb opened this issue Nov 8, 2016 · 2 comments
Closed

Incorrect protocol number at headers #161

emanuelb opened this issue Nov 8, 2016 · 2 comments

Comments

@emanuelb
Copy link

emanuelb commented Nov 8, 2016

The following code:

        \header('HTTP/1.1 403 Forbidden');
        \header('HTTP/1.1 404 Not Found');

used in:
https://github.com/paragonie/airship/blob/master/src/cabins.php#L138
https://github.com/paragonie/airship/blob/master/src/Cabin/Bridge/Landing/IndexPage.php#L112
https://github.com/paragonie/airship/blob/master/src/bootstrap.php#L32
https://github.com/paragonie/airship/blob/master/src/Cabin/Hull/Landing/CustomPages.php#L93
https://github.com/paragonie/airship/blob/master/src/Engine/AutoPilot.php#L470

hardcode 'HTTP/1.1' which is incorrect if the client sent HTTP 1.0 request / connection made over HTTP 2, thus may cause bugs:
https://secure.php.net/manual/en/function.header.php#92305

fix:
use code that based on the solution at:
https://stackoverflow.com/questions/3258634/php-how-to-send-http-response-code#23190950
or use http_response_code function:
https://secure.php.net/http_response_code

@paragonie-scott
Copy link
Member

This is absolutely my fault and I will get this fixed in the next release. Thank you very much for this report.

@kelunik
Copy link
Contributor

kelunik commented Nov 8, 2016

Section 19.6 of https://www.ietf.org/rfc/rfc2616.txt

[...] we would expect commercial HTTP/1.1 servers to:

  • recognize the format of the Request-Line for HTTP/0.9, 1.0, and 1.1 requests;
  • understand any valid request in the format of HTTP/0.9, 1.0, or 1.1;
  • respond appropriately with a message in the same major version used by the client.

That means the response is correct for HTTP/1.0 requests. I guess Airship doesn't have to support HTTP/0.9. For HTTP/2 I have no idea how Apache and other SAPIs handle that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants