HTTP: do not allow status line to end with bare LF

This is consistent with llhttp.
This commit is contained in:
Demi Marie Obenour 2025-03-16 17:07:40 -04:00
parent bd37faff72
commit 7032a60fa0

View File

@ -732,10 +732,6 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
break; break;
} }
if (ch == LF) {
goto done;
}
if (ch == ' ') { if (ch == ' ') {
state = sw_spaces_after_digit; state = sw_spaces_after_digit;
break; break;
@ -1896,8 +1892,6 @@ ngx_http_parse_status_line(ngx_http_request_t *r, ngx_buf_t *b,
case CR: case CR:
state = sw_almost_done; state = sw_almost_done;
break; break;
case LF:
goto done;
default: default:
return NGX_ERROR; return NGX_ERROR;
} }
@ -1910,7 +1904,6 @@ ngx_http_parse_status_line(ngx_http_request_t *r, ngx_buf_t *b,
state = sw_almost_done; state = sw_almost_done;
break; break;
case LF:
goto done; goto done;
default: default:
if (ch < 0x20 || ch == 0x7f) { if (ch < 0x20 || ch == 0x7f) {