mirror of
https://github.com/nginx/nginx.git
synced 2024-12-05 06:19:01 +08:00
Protocol version parsing in ngx_http_parse_status_line().
Once we know protocol version, set u->headers_in.connection_close to indicate implicitly assumed connection close with HTTP before 1.1.
This commit is contained in:
parent
f84c69a301
commit
f2fcf11b25
@ -1210,6 +1210,7 @@ ngx_http_proxy_process_status_line(ngx_http_request_t *r)
|
|||||||
|
|
||||||
r->http_version = NGX_HTTP_VERSION_9;
|
r->http_version = NGX_HTTP_VERSION_9;
|
||||||
u->state->status = NGX_HTTP_OK;
|
u->state->status = NGX_HTTP_OK;
|
||||||
|
u->headers_in.connection_close = 1;
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
@ -1234,6 +1235,10 @@ ngx_http_proxy_process_status_line(ngx_http_request_t *r)
|
|||||||
"http proxy status %ui \"%V\"",
|
"http proxy status %ui \"%V\"",
|
||||||
u->headers_in.status_n, &u->headers_in.status_line);
|
u->headers_in.status_n, &u->headers_in.status_line);
|
||||||
|
|
||||||
|
if (ctx->status.http_version < NGX_HTTP_VERSION_11) {
|
||||||
|
u->headers_in.connection_close = 1;
|
||||||
|
}
|
||||||
|
|
||||||
u->process_header = ngx_http_proxy_process_header;
|
u->process_header = ngx_http_proxy_process_header;
|
||||||
|
|
||||||
return ngx_http_proxy_process_header(r);
|
return ngx_http_proxy_process_header(r);
|
||||||
|
@ -52,6 +52,7 @@ struct ngx_http_log_ctx_s {
|
|||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
ngx_uint_t http_version;
|
||||||
ngx_uint_t code;
|
ngx_uint_t code;
|
||||||
ngx_uint_t count;
|
ngx_uint_t count;
|
||||||
u_char *start;
|
u_char *start;
|
||||||
|
@ -1403,6 +1403,7 @@ ngx_http_parse_status_line(ngx_http_request_t *r, ngx_buf_t *b,
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r->http_major = ch - '0';
|
||||||
state = sw_major_digit;
|
state = sw_major_digit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1417,6 +1418,7 @@ ngx_http_parse_status_line(ngx_http_request_t *r, ngx_buf_t *b,
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r->http_major = r->http_major * 10 + ch - '0';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* the first digit of minor HTTP version */
|
/* the first digit of minor HTTP version */
|
||||||
@ -1425,6 +1427,7 @@ ngx_http_parse_status_line(ngx_http_request_t *r, ngx_buf_t *b,
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r->http_minor = ch - '0';
|
||||||
state = sw_minor_digit;
|
state = sw_minor_digit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1439,6 +1442,7 @@ ngx_http_parse_status_line(ngx_http_request_t *r, ngx_buf_t *b,
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r->http_minor = r->http_minor * 10 + ch - '0';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* HTTP status code */
|
/* HTTP status code */
|
||||||
@ -1516,6 +1520,7 @@ done:
|
|||||||
status->end = p;
|
status->end = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status->http_version = r->http_major * 1000 + r->http_minor;
|
||||||
r->state = sw_start;
|
r->state = sw_start;
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user