Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_uwsgi_module.c @ 4527:9c3a2fc3c460
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).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 15 Mar 2012 11:21:54 +0000 |
parents | 14411ee4d89f |
children | 1ebec1d15a25 |
comparison
equal
deleted
inserted
replaced
4526:e954f40fc28b | 4527:9c3a2fc3c460 |
---|---|
40 static ngx_int_t ngx_http_uwsgi_eval(ngx_http_request_t *r, | 40 static ngx_int_t ngx_http_uwsgi_eval(ngx_http_request_t *r, |
41 ngx_http_uwsgi_loc_conf_t *uwcf); | 41 ngx_http_uwsgi_loc_conf_t *uwcf); |
42 static ngx_int_t ngx_http_uwsgi_create_request(ngx_http_request_t *r); | 42 static ngx_int_t ngx_http_uwsgi_create_request(ngx_http_request_t *r); |
43 static ngx_int_t ngx_http_uwsgi_reinit_request(ngx_http_request_t *r); | 43 static ngx_int_t ngx_http_uwsgi_reinit_request(ngx_http_request_t *r); |
44 static ngx_int_t ngx_http_uwsgi_process_status_line(ngx_http_request_t *r); | 44 static ngx_int_t ngx_http_uwsgi_process_status_line(ngx_http_request_t *r); |
45 static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r); | |
46 static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r); | 45 static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r); |
47 static void ngx_http_uwsgi_abort_request(ngx_http_request_t *r); | 46 static void ngx_http_uwsgi_abort_request(ngx_http_request_t *r); |
48 static void ngx_http_uwsgi_finalize_request(ngx_http_request_t *r, | 47 static void ngx_http_uwsgi_finalize_request(ngx_http_request_t *r, |
49 ngx_int_t rc); | 48 ngx_int_t rc); |
50 | 49 |
910 if (rc == NGX_AGAIN) { | 909 if (rc == NGX_AGAIN) { |
911 return rc; | 910 return rc; |
912 } | 911 } |
913 | 912 |
914 if (rc == NGX_ERROR) { | 913 if (rc == NGX_ERROR) { |
915 r->http_version = NGX_HTTP_VERSION_9; | |
916 | |
917 u->process_header = ngx_http_uwsgi_process_header; | 914 u->process_header = ngx_http_uwsgi_process_header; |
918 | |
919 return ngx_http_uwsgi_process_header(r); | 915 return ngx_http_uwsgi_process_header(r); |
920 } | 916 } |
921 | 917 |
922 if (u->state) { | 918 if (u->state) { |
923 u->state->status = status->code; | 919 u->state->status = status->code; |
1013 /* a whole header has been parsed successfully */ | 1009 /* a whole header has been parsed successfully */ |
1014 | 1010 |
1015 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 1011 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1016 "http uwsgi header done"); | 1012 "http uwsgi header done"); |
1017 | 1013 |
1018 if (r->http_version > NGX_HTTP_VERSION_9) { | 1014 u = r->upstream; |
1015 | |
1016 if (u->headers_in.status_n) { | |
1019 return NGX_OK; | 1017 return NGX_OK; |
1020 } | 1018 } |
1021 | |
1022 u = r->upstream; | |
1023 | 1019 |
1024 if (u->headers_in.status) { | 1020 if (u->headers_in.status) { |
1025 status_line = &u->headers_in.status->value; | 1021 status_line = &u->headers_in.status->value; |
1026 | 1022 |
1027 status = ngx_atoi(status_line->data, 3); | 1023 status = ngx_atoi(status_line->data, 3); |
1030 "upstream sent invalid status \"%V\"", | 1026 "upstream sent invalid status \"%V\"", |
1031 status_line); | 1027 status_line); |
1032 return NGX_HTTP_UPSTREAM_INVALID_HEADER; | 1028 return NGX_HTTP_UPSTREAM_INVALID_HEADER; |
1033 } | 1029 } |
1034 | 1030 |
1035 r->http_version = NGX_HTTP_VERSION_10; | |
1036 u->headers_in.status_n = status; | 1031 u->headers_in.status_n = status; |
1037 u->headers_in.status_line = *status_line; | 1032 u->headers_in.status_line = *status_line; |
1038 | 1033 |
1039 } else if (u->headers_in.location) { | 1034 } else if (u->headers_in.location) { |
1040 r->http_version = NGX_HTTP_VERSION_10; | |
1041 u->headers_in.status_n = 302; | 1035 u->headers_in.status_n = 302; |
1042 ngx_str_set(&u->headers_in.status_line, | 1036 ngx_str_set(&u->headers_in.status_line, |
1043 "302 Moved Temporarily"); | 1037 "302 Moved Temporarily"); |
1044 | 1038 |
1045 } else { | 1039 } else { |
1046 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1047 "upstream sent neither valid HTTP/1.0 header " | |
1048 "nor \"Status\" header line"); | |
1049 u->headers_in.status_n = 200; | 1040 u->headers_in.status_n = 200; |
1050 ngx_str_set(&u->headers_in.status_line, "200 OK"); | 1041 ngx_str_set(&u->headers_in.status_line, "200 OK"); |
1051 } | 1042 } |
1052 | 1043 |
1053 if (u->state) { | 1044 if (u->state) { |