Mercurial > hg > nginx
comparison src/http/ngx_http_request_body.c @ 509:9b8c906f6e63 release-0.1.29
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 12 May 2005 14:58:06 +0000 |
parents | d4ea69372b94 |
children | 7fa11e5c6e96 |
comparison
equal
deleted
inserted
replaced
508:ca1020ce99ba | 509:9b8c906f6e63 |
---|---|
8 #include <ngx_core.h> | 8 #include <ngx_core.h> |
9 #include <ngx_event.h> | 9 #include <ngx_event.h> |
10 #include <ngx_http.h> | 10 #include <ngx_http.h> |
11 | 11 |
12 | 12 |
13 static void ngx_http_read_client_request_body_handler(ngx_event_t *rev); | 13 static void ngx_http_read_client_request_body_handler(ngx_http_request_t *r); |
14 static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r, | 14 static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r); |
15 ngx_connection_t *c); | |
16 | 15 |
17 /* | 16 /* |
18 * on completion ngx_http_read_client_request_body() adds to | 17 * on completion ngx_http_read_client_request_body() adds to |
19 * r->request_body->bufs one or two bufs: | 18 * r->request_body->bufs one or two bufs: |
20 * *) one memory buf that was preread in r->header_in; | 19 * *) one memory buf that was preread in r->header_in; |
27 | 26 |
28 { | 27 { |
29 ssize_t size; | 28 ssize_t size; |
30 ngx_buf_t *b; | 29 ngx_buf_t *b; |
31 ngx_chain_t *cl; | 30 ngx_chain_t *cl; |
32 ngx_connection_t *c; | |
33 ngx_http_request_body_t *rb; | 31 ngx_http_request_body_t *rb; |
34 ngx_http_core_loc_conf_t *clcf; | 32 ngx_http_core_loc_conf_t *clcf; |
33 | |
34 if (r->request_body) { | |
35 post_handler(r); | |
36 return NGX_OK; | |
37 } | |
35 | 38 |
36 rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t)); | 39 rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t)); |
37 if (rb == NULL) { | 40 if (rb == NULL) { |
38 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 41 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
39 } | 42 } |
40 | 43 |
41 r->request_body = rb; | 44 r->request_body = rb; |
42 | |
43 /* STUB */ | |
44 if (r->file.fd != NGX_INVALID_FILE) { | |
45 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) { | |
46 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, | |
47 ngx_close_file_n " \"%V\" failed", &r->file.name); | |
48 } | |
49 r->file.fd = NGX_INVALID_FILE; | |
50 } | |
51 /**/ | |
52 | 45 |
53 if (r->headers_in.content_length_n <= 0) { | 46 if (r->headers_in.content_length_n <= 0) { |
54 post_handler(r); | 47 post_handler(r); |
55 return NGX_OK; | 48 return NGX_OK; |
56 } | 49 } |
136 | 129 |
137 } else { | 130 } else { |
138 rb->bufs = cl; | 131 rb->bufs = cl; |
139 } | 132 } |
140 | 133 |
141 c = r->connection; | 134 r->read_event_handler = ngx_http_read_client_request_body_handler; |
142 | 135 |
143 c->read->event_handler = ngx_http_read_client_request_body_handler; | 136 return ngx_http_do_read_client_request_body(r); |
144 | |
145 return ngx_http_do_read_client_request_body(r, c); | |
146 } | 137 } |
147 | 138 |
148 | 139 |
149 static void | 140 static void |
150 ngx_http_read_client_request_body_handler(ngx_event_t *rev) | 141 ngx_http_read_client_request_body_handler(ngx_http_request_t *r) |
151 { | 142 { |
152 ngx_int_t rc; | 143 ngx_int_t rc; |
153 ngx_connection_t *c; | 144 |
154 ngx_http_request_t *r; | 145 if (r->connection->read->timedout) { |
155 | |
156 c = rev->data; | |
157 r = c->data; | |
158 | |
159 if (rev->timedout) { | |
160 ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT); | 146 ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT); |
161 return; | 147 return; |
162 } | 148 } |
163 | 149 |
164 rc = ngx_http_do_read_client_request_body(r, c); | 150 rc = ngx_http_do_read_client_request_body(r); |
165 | 151 |
166 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { | 152 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { |
167 ngx_http_finalize_request(r, rc); | 153 ngx_http_finalize_request(r, rc); |
168 } | 154 } |
169 } | 155 } |
170 | 156 |
171 | 157 |
172 static ngx_int_t | 158 static ngx_int_t |
173 ngx_http_do_read_client_request_body(ngx_http_request_t *r, | 159 ngx_http_do_read_client_request_body(ngx_http_request_t *r) |
174 ngx_connection_t *c) | |
175 { | 160 { |
176 size_t size; | 161 size_t size; |
177 ssize_t n; | 162 ssize_t n; |
178 ngx_buf_t *b; | 163 ngx_buf_t *b; |
179 ngx_temp_file_t *tf; | 164 ngx_temp_file_t *tf; |
165 ngx_connection_t *c; | |
180 ngx_http_request_body_t *rb; | 166 ngx_http_request_body_t *rb; |
181 ngx_http_core_loc_conf_t *clcf; | 167 ngx_http_core_loc_conf_t *clcf; |
182 | 168 |
169 c = r->connection; | |
183 rb = r->request_body; | 170 rb = r->request_body; |
184 | 171 |
185 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, | 172 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
186 "http read client request body"); | 173 "http read client request body"); |
187 | 174 |
216 if (n == NGX_ERROR) { | 203 if (n == NGX_ERROR) { |
217 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 204 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
218 } | 205 } |
219 | 206 |
220 rb->temp_file->offset += n; | 207 rb->temp_file->offset += n; |
221 | |
222 rb->buf->pos = rb->buf->start; | |
223 rb->buf->last = rb->buf->start; | 208 rb->buf->last = rb->buf->start; |
224 } | 209 } |
225 | 210 |
226 size = rb->buf->end - rb->buf->last; | 211 size = rb->buf->end - rb->buf->last; |
227 | 212 |