mirror of
https://github.com/nginx/nginx.git
synced 2025-07-25 22:56:59 +08:00
Uwsgi: merged r->http_version fixes from scgi module.
Fixed incorrect use of r->http_version (r4372). Removed duplicate function declaration (r4373). Removed error if there is no Status header (r4374).
This commit is contained in:
parent
de964a9a27
commit
205394e6f9
@ -43,7 +43,6 @@ static ngx_int_t ngx_http_uwsgi_create_request(ngx_http_request_t *r);
|
|||||||
static ngx_int_t ngx_http_uwsgi_reinit_request(ngx_http_request_t *r);
|
static ngx_int_t ngx_http_uwsgi_reinit_request(ngx_http_request_t *r);
|
||||||
static ngx_int_t ngx_http_uwsgi_process_status_line(ngx_http_request_t *r);
|
static ngx_int_t ngx_http_uwsgi_process_status_line(ngx_http_request_t *r);
|
||||||
static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r);
|
static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r);
|
||||||
static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r);
|
|
||||||
static void ngx_http_uwsgi_abort_request(ngx_http_request_t *r);
|
static void ngx_http_uwsgi_abort_request(ngx_http_request_t *r);
|
||||||
static void ngx_http_uwsgi_finalize_request(ngx_http_request_t *r,
|
static void ngx_http_uwsgi_finalize_request(ngx_http_request_t *r,
|
||||||
ngx_int_t rc);
|
ngx_int_t rc);
|
||||||
@ -912,10 +911,7 @@ ngx_http_uwsgi_process_status_line(ngx_http_request_t *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rc == NGX_ERROR) {
|
if (rc == NGX_ERROR) {
|
||||||
r->http_version = NGX_HTTP_VERSION_9;
|
|
||||||
|
|
||||||
u->process_header = ngx_http_uwsgi_process_header;
|
u->process_header = ngx_http_uwsgi_process_header;
|
||||||
|
|
||||||
return ngx_http_uwsgi_process_header(r);
|
return ngx_http_uwsgi_process_header(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1015,12 +1011,12 @@ ngx_http_uwsgi_process_header(ngx_http_request_t *r)
|
|||||||
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||||
"http uwsgi header done");
|
"http uwsgi header done");
|
||||||
|
|
||||||
if (r->http_version > NGX_HTTP_VERSION_9) {
|
u = r->upstream;
|
||||||
|
|
||||||
|
if (u->headers_in.status_n) {
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
u = r->upstream;
|
|
||||||
|
|
||||||
if (u->headers_in.status) {
|
if (u->headers_in.status) {
|
||||||
status_line = &u->headers_in.status->value;
|
status_line = &u->headers_in.status->value;
|
||||||
|
|
||||||
@ -1032,20 +1028,15 @@ ngx_http_uwsgi_process_header(ngx_http_request_t *r)
|
|||||||
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
|
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
r->http_version = NGX_HTTP_VERSION_10;
|
|
||||||
u->headers_in.status_n = status;
|
u->headers_in.status_n = status;
|
||||||
u->headers_in.status_line = *status_line;
|
u->headers_in.status_line = *status_line;
|
||||||
|
|
||||||
} else if (u->headers_in.location) {
|
} else if (u->headers_in.location) {
|
||||||
r->http_version = NGX_HTTP_VERSION_10;
|
|
||||||
u->headers_in.status_n = 302;
|
u->headers_in.status_n = 302;
|
||||||
ngx_str_set(&u->headers_in.status_line,
|
ngx_str_set(&u->headers_in.status_line,
|
||||||
"302 Moved Temporarily");
|
"302 Moved Temporarily");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
|
||||||
"upstream sent neither valid HTTP/1.0 header "
|
|
||||||
"nor \"Status\" header line");
|
|
||||||
u->headers_in.status_n = 200;
|
u->headers_in.status_n = 200;
|
||||||
ngx_str_set(&u->headers_in.status_line, "200 OK");
|
ngx_str_set(&u->headers_in.status_line, "200 OK");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user