annotate auto/cc/ccc @ 4247:b79dbadb3d5e stable-1.0

Merging r4147, r4148, r4149, r4150, r4207: Fixes of combination of error_page and return directives: *) Fix for incorrect 201 replies from dav module. Replies with 201 code contain body, and we should clearly indicate it's empty if it's empty. Before 0.8.32 chunked was explicitly disabled for 201 replies and as a result empty body was indicated by connection close (not perfect, but worked). Since 0.8.32 chunked is enabled, and this causes incorrect responses from dav module when HTTP/1.1 is used: with "Transfer-Encoding: chunked" but no chunks at all. Fix is to actually return empty body in special response handler instead of abusing r->header_only flag. See here for initial report: http://mailman.nginx.org/pipermail/nginx-ru/2010-October/037535.html *) Fix for double content when return is used in error_page handler. Test case: location / { error_page 405 /nope; return 405; } location /nope { return 200; } This is expected to return 405 with empty body, but in 0.8.42+ will return builtin 405 error page as well (though not counted in Content-Length, thus breaking protocol). Fix is to use status provided by rewrite script execution in case it's less than NGX_HTTP_BAD_REQUEST even if r->error_status set. This check is in line with one in ngx_http_script_return_code(). Note that this patch also changes behaviour for "return 302 ..." and "rewrite ... redirect" used as error handler. E.g. location / { error_page 405 /redirect; return 405; } location /redirect { rewrite ^ http://example.com/; } will actually return redirect to "http://example.com/" instead of builtin 405 error page with meaningless Location header. This looks like correct change and it's in line with what happens on e.g. directory redirects in error handlers. *) Fix for "return 202" not discarding body. Big POST (not fully preread) to a location / { return 202; } resulted in incorrect behaviour due to "return" code path not calling ngx_http_discard_request_body(). The same applies to all "return" used with 2xx/3xx codes except 201 and 204, and to all "return ... text" uses. Fix is to add ngx_http_discard_request_body() call to ngx_http_send_response() function where it looks appropriate. Discard body call from emtpy gif module removed as it's now redundant. Reported by Pyry Hakulinen, see http://mailman.nginx.org/pipermail/nginx/2011-August/028503.html *) Incorrect special case for "return 204" removed. The special case in question leads to replies without body in configuration like location / { error_page 404 /zero; return 404; } location /zero { return 204; } while replies with empty body are expected per protocol specs. Correct one will look like if (status == NGX_HTTP_NO_CONTENT) { rc = ngx_http_send_header(r); if (rc == NGX_ERROR || r->header_only) { return rc; } return ngx_http_send_special(r, NGX_HTTP_LAST); } though it looks like it's better to drop this special case at all. *) Clear old Location header (if any) while adding a new one. This prevents incorrect behaviour when another redirect is issued within error_page 302 handler.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 01 Nov 2011 13:45:33 +0000
parents dadfa78d2270
children d620f497c50f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
515
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2 # Copyright (C) Igor Sysoev
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
3
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
4
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5 # Compaq C V6.5-207
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7 ngx_include_opt="-I"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 # warnings
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11 CFLAGS="$CFLAGS -msg_enable level6 -msg_fatal level6"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
12
517
dadfa78d2270 nginx-0.1.33-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 515
diff changeset
13 CFLAGS="$CFLAGS -msg_disable unknownmacro"
dadfa78d2270 nginx-0.1.33-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 515
diff changeset
14 CFLAGS="$CFLAGS -msg_disable unusedincl"
515
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
15 CFLAGS="$CFLAGS -msg_disable unnecincl"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
16 CFLAGS="$CFLAGS -msg_disable nestincl"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
17 CFLAGS="$CFLAGS -msg_disable strctpadding"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
18 CFLAGS="$CFLAGS -msg_disable ansialiascast"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
19 CFLAGS="$CFLAGS -msg_disable inlinestoclsmod"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
20 CFLAGS="$CFLAGS -msg_disable cxxkeyword"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
21 CFLAGS="$CFLAGS -msg_disable longlongsufx"
517
dadfa78d2270 nginx-0.1.33-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 515
diff changeset
22 CFLAGS="$CFLAGS -msg_disable valuepres"
515
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
23
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
24 # STUB
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
25 CFLAGS="$CFLAGS -msg_disable truncintcast"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
26 CFLAGS="$CFLAGS -msg_disable trunclongcast"
517
dadfa78d2270 nginx-0.1.33-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 515
diff changeset
27
515
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
28 CFLAGS="$CFLAGS -msg_disable truncintasn"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
29 CFLAGS="$CFLAGS -msg_disable trunclongint"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
30 CFLAGS="$CFLAGS -msg_disable intconcastsgn"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
31 CFLAGS="$CFLAGS -msg_disable intconstsign"
517
dadfa78d2270 nginx-0.1.33-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 515
diff changeset
32 CFLAGS="$CFLAGS -msg_disable switchlong"
dadfa78d2270 nginx-0.1.33-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 515
diff changeset
33 CFLAGS="$CFLAGS -msg_disable subscrbounds2"
dadfa78d2270 nginx-0.1.33-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 515
diff changeset
34
515
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
35 CFLAGS="$CFLAGS -msg_disable hexoctunsign"
517
dadfa78d2270 nginx-0.1.33-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 515
diff changeset
36
515
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
37 CFLAGS="$CFLAGS -msg_disable ignorecallval"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
38 CFLAGS="$CFLAGS -msg_disable nonstandcast"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
39 CFLAGS="$CFLAGS -msg_disable embedcomment"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
40 CFLAGS="$CFLAGS -msg_disable unreachcode"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
41 CFLAGS="$CFLAGS -msg_disable questcompare2"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
42 CFLAGS="$CFLAGS -msg_disable unusedtop"
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
43 CFLAGS="$CFLAGS -msg_disable unrefdecl"
517
dadfa78d2270 nginx-0.1.33-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 515
diff changeset
44
515
417a087c9c4d nginx-0.1.32-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
45 CFLAGS="$CFLAGS -msg_disable bitnotint"