From: Sergey Kandaurov Date: Wed, 29 Apr 2026 19:02:20 +0000 (+0400) Subject: Upstream: fixed parsing of split status lines X-Git-Tag: release-1.31.0~3 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/postgres_fdw.c?a=commitdiff_plain;h=5f86648ef8c969e98aa2f7b938472296b12055be;p=nginx.git Upstream: fixed parsing of split status lines If the first response line was split across reads and it didn't appear a status line, the portion already processed was lost. The change introduces a new field for proper backtracking on status line fallback. --- diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c index e33dc37fd..7e08df702 100644 --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -1761,6 +1761,7 @@ ngx_http_proxy_process_status_line(ngx_http_request_t *r) } if (rc == NGX_ERROR) { + u->buffer.pos = ctx->status.line_start; #if (NGX_HTTP_CACHE) diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c index 290394a1f..406b5f88f 100644 --- a/src/http/modules/ngx_http_scgi_module.c +++ b/src/http/modules/ngx_http_scgi_module.c @@ -1036,6 +1036,7 @@ ngx_http_scgi_process_status_line(ngx_http_request_t *r) if (rc == NGX_ERROR) { u->process_header = ngx_http_scgi_process_header; + u->buffer.pos = status->line_start; r->state = 0; return ngx_http_scgi_process_header(r); } diff --git a/src/http/modules/ngx_http_uwsgi_module.c b/src/http/modules/ngx_http_uwsgi_module.c index 4140b1b40..cb03ca77c 100644 --- a/src/http/modules/ngx_http_uwsgi_module.c +++ b/src/http/modules/ngx_http_uwsgi_module.c @@ -1275,6 +1275,7 @@ ngx_http_uwsgi_process_status_line(ngx_http_request_t *r) if (rc == NGX_ERROR) { u->process_header = ngx_http_uwsgi_process_header; + u->buffer.pos = status->line_start; r->state = 0; return ngx_http_uwsgi_process_header(r); } diff --git a/src/http/ngx_http.h b/src/http/ngx_http.h index 4e4511cc5..1b0e369f3 100644 --- a/src/http/ngx_http.h +++ b/src/http/ngx_http.h @@ -72,6 +72,7 @@ typedef struct { ngx_uint_t http_version; ngx_uint_t code; ngx_uint_t count; + u_char *line_start; u_char *start; u_char *end; } ngx_http_status_t; diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c index ac10f561a..e1328da04 100644 --- a/src/http/ngx_http_parse.c +++ b/src/http/ngx_http_parse.c @@ -1703,6 +1703,8 @@ ngx_http_parse_status_line(ngx_http_request_t *r, ngx_buf_t *b, /* "HTTP/" */ case sw_start: + status->line_start = p; + switch (ch) { case 'H': state = sw_H;