Mercurial > hg > nginx
comparison src/http/modules/ngx_http_fastcgi_module.c @ 9155:35bb47f65cab
Upstream: fixed handling of Status headers without reason-phrase.
Status header with an empty reason-phrase, such as "Status: 404 ", is
valid per CGI specification, but looses the trailing space during parsing.
Currently, this results in "HTTP/1.1 404" HTTP status line in the response,
which violates HTTP specification due to missing trailing space.
With this change, only the status code is used from such short Status
header lines, so nginx will generate status line itself, with the space
and appropriate reason phrase if available.
Reported at:
https://mailman.nginx.org/pipermail/nginx/2023-August/EX7G4JUUHJWJE5UOAZMO5UD6OJILCYGX.html
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 31 Aug 2023 22:59:17 +0300 |
parents | 2bf7792c262e |
children | 098019656024 |
comparison
equal
deleted
inserted
replaced
9154:f6b6f3dd7ca0 | 9155:35bb47f65cab |
---|---|
2046 status_line); | 2046 status_line); |
2047 return NGX_HTTP_UPSTREAM_INVALID_HEADER; | 2047 return NGX_HTTP_UPSTREAM_INVALID_HEADER; |
2048 } | 2048 } |
2049 | 2049 |
2050 u->headers_in.status_n = status; | 2050 u->headers_in.status_n = status; |
2051 u->headers_in.status_line = *status_line; | 2051 |
2052 if (status_line->len > 3) { | |
2053 u->headers_in.status_line = *status_line; | |
2054 } | |
2052 | 2055 |
2053 } else if (u->headers_in.location) { | 2056 } else if (u->headers_in.location) { |
2054 u->headers_in.status_n = 302; | 2057 u->headers_in.status_n = 302; |
2055 ngx_str_set(&u->headers_in.status_line, | 2058 ngx_str_set(&u->headers_in.status_line, |
2056 "302 Moved Temporarily"); | 2059 "302 Moved Temporarily"); |