[nginx] Upstream: reset parsing state after invalid status line.

Maxim Dounin mdounin at mdounin.ru
Tue May 19 02:46:31 UTC 2026


details:   http://freenginx.org/hg/nginx/rev/a2337bcaaea6
branches:  
changeset: 9525:a2337bcaaea6
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Wed Apr 29 21:56:51 2026 +0400
description:
Upstream: reset parsing state after invalid status line.

Previously, it was possible to start parsing headers with a wrong
parsing state after status line was not recognized, as a fallback
used in the scgi and uwsgi modules.

Reported by Leo Lin.

Obtained from:
https://github.com/nginx/nginx/commit/f79c286b34d3b708bd4856a56e27529e11386098

diffstat:

 src/http/modules/ngx_http_scgi_module.c  |  1 +
 src/http/modules/ngx_http_uwsgi_module.c |  1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diffs (22 lines):

diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c
--- a/src/http/modules/ngx_http_scgi_module.c
+++ b/src/http/modules/ngx_http_scgi_module.c
@@ -1014,6 +1014,7 @@ ngx_http_scgi_process_status_line(ngx_ht
 
     if (rc == NGX_ERROR) {
         u->process_header = ngx_http_scgi_process_header;
+        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
--- a/src/http/modules/ngx_http_uwsgi_module.c
+++ b/src/http/modules/ngx_http_uwsgi_module.c
@@ -1245,6 +1245,7 @@ ngx_http_uwsgi_process_status_line(ngx_h
 
     if (rc == NGX_ERROR) {
         u->process_header = ngx_http_uwsgi_process_header;
+        r->state = 0;
         return ngx_http_uwsgi_process_header(r);
     }
 


More information about the nginx-devel mailing list