summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-03-15Merge of r4530, r4531: null character fixes.Maxim Dounin4-10/+16
*) Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header(). This resulted in a disclosure of previously freed memory if upstream server returned specially crafted response, potentially exposing sensitive information. Reported by Matthew Daley. *) Headers with null character are now rejected. Headers with NUL character aren't allowed by HTTP standard and may cause various security problems. They are now unconditionally rejected.
2012-03-15Version bump.Maxim Dounin1-1/+1
2012-03-05Merge of r4500: fixed spelling in single-line comments.Maxim Dounin10-27/+27
2012-03-05Merge of r4498:Maxim Dounin2-47/+37
Fix of rbtree lookup on hash collisions. Previous code incorrectly assumed that nodes with identical keys are linked together. This might not be true after tree rebalance. Patch by Lanshun Zhou.
2012-03-05Merge of r4491, r4492:Maxim Dounin2-1/+7
*) Renamed constants and fixed off-by-one error in "msie_padding on" handling. *) Added support for the 307 Temporary Redirect.
2012-03-05Merge of r4474, r4493: configure/build fixes.Maxim Dounin1-1/+5
*) Fixed build with embedded perl and --with-openssl. *) Configure: moved icc detection before gcc. New versions of icc confuse auto/cc/name due to introduced handling of a "icc -v".
2012-03-05Merge of r4468:Maxim Dounin1-20/+6
Removed r->cache/r->cached dependencies in range filter. This is a layering violation, use correct offset calculations instead.
2012-03-05Merge of r4423: fixed proxy_redirect off inheritance.Maxim Dounin1-0/+2
2012-03-05Version bump.Maxim Dounin1-1/+1
2012-02-05Merge of r4406, r4413: copyrights updated.Maxim Dounin50-0/+50
2012-02-05Merge of r4402:Maxim Dounin4-5/+21
Fixed proxy_cache_use_stale in "no live upstreams" case.
2012-02-05Merge of r4401, r4415:Maxim Dounin2-2/+7
SSL changes: *) Added support for TLSv1.1, TLSv1.2 in ssl_protocols directive. Support for TLSv1.1 and TLSv1.2 protocols was introduced in OpenSSL 1.0.1 (-beta1 was recently released). This change makes it possible to disable these protocols and/or enable them without other protocols. *) Removed ENGINE_load_builtin_engines() call. It's already called by OPENSSL_config(). Calling it again causes some openssl engines (notably GOST) to corrupt memory, as they don't expect to be created more than once.
2012-02-05Merge of r4383, r4403:Maxim Dounin1-4/+6
MP4 fixes: *) Fixed mp4 if first entry in stsc was skipped (ticket #72). If first entry in stsc atom was skipped, and seek was to chunk boundary, than first_chunk in the generated stsc table wasn't set to 1. *) Fixed handling of mp4 above 2G and 32bit offsets (ticket #84).
2012-02-05Merge of r4381, r4400:Maxim Dounin2-2/+5
Fixed limit_conn_log_level/limit_req_log_level inheritance. The directives did not work if there were no limit_conn/limit_req specified on the same level. The code for limit_conn is different in 1.0.x, conflict resolved manually.
2012-02-05Merge of r4375, r4382:Maxim Dounin2-39/+158
SSI changes: *) The "if" command did not work inside the "block" command and produced parsing errors. *) Added regex captures support in the expression of the "if" command.
2012-02-05Merge of r4372, r4373, r4374:Maxim Dounin1-13/+3
SCGI fixes: *) Fixed incorrect use of r->http_version in scgi module. The r->http_version is a version of client's request, and modules must not set it unless they are really willing to downgrade protocol version used for a response (i.e. to HTTP/0.9 if no response headers are available). In neither case r->http_version may be upgraded. The former code downgraded response from HTTP/1.1 to HTTP/1.0 for no reason, causing various problems (see ticket #66). It was also possible that HTTP/0.9 requests were upgraded to HTTP/1.0. *) Removed duplicate function declaration. *) Removed error if there is no Status header. The SCGI specification doesn't specify format of the response, and assuming CGI specs should be used there is no reason to complain. RFC 3875 explicitly states that "A Status header field is optional, and status 200 'OK' is assumed if it is omitted".
2012-02-04Version bump.Maxim Dounin1-1/+1
2011-12-14Merge of r4315:Maxim Dounin1-0/+1
Allowed add_header for proxied 206 replies. It was working for nginx's own 206 replies as they are seen as 200 in the headers filter module (range filter goes later in the headers filter chain), but not for proxied replies.
2011-12-14Merge of r4307:Maxim Dounin1-1/+1
Fix of mp4 module seeking.
2011-12-14Merge of r4298:Maxim Dounin1-1/+1
Fixed flv header to match specification. Used "\x5" in 5th byte to claim presence of both audio and video. Used previous tag size 0 in the beginning of the flv body (bytes 10 .. 13) as required by specification (see http://www.adobe.com/devnet/f4v.html). Patch by Piotr Sikora.
2011-12-14Merge of r4295:Maxim Dounin1-1/+3
Fixed incorrect counting the length of headers in a SCGI request.
2011-12-14Merge of r4275, r4276, r4278, r4279:Maxim Dounin4-194/+323
Fixes for proxy_set_header, fastcgi/scgi/uwsgi_param inheritance: *) Fixed proxy_set_header inheritance with proxy_cache (ticket #45). Headers cleared with cache enabled (If-Modified-Since etc.) might be cleared in unrelated servers/locations without proxy_cache enabled if proxy_cache was used in some server/location. Example config which triggered the problem: proxy_set_header X-Test "test"; server { location /1 { proxy_cache name; proxy_pass ... } } server { location /2 { proxy_pass ... } } Another one: server { proxy_cache name; location /1 { proxy_pass ... } location /2 { proxy_cache off; proxy_pass ... } } In both cases If-Modified-Since header wasn't sent to backend in location /2. Fix is to not modify conf->headers_source, but instead merge user-supplied headers from conf->headers_source and default headers (either cache or not) into separate headers_merged array. *) Fixed proxy_set_header inheritance with proxy_set_body. *) Separate functions to merge fastcgi/scgi/uwsgi params. No functional changes. *) Fixed fastcgi/scgi/uwsgi_param inheritance. The following problems were fixed: 1. Directive fastcgi_cache affected headers sent to backends in unrelated servers / locations (see ticket #45). 2. If-Unmodified-Since, If-Match and If-Range headers were sent to backends if fastcgi_cache was used. 3. Cache-related headers were sent to backends if there were no fastcgi_param directives and fastcgi_cache was used at server level.
2011-12-14Merge of r4270, r4274:Maxim Dounin3-4/+4
Minor cleanup: *) Changed error message to be more appropriate in the imaginary "open_file_cache max=0" case. *) Fixed NGX_CONF_TAKE1/NGX_CONF_FLAG misuse.
2011-12-14Merge of r4266, r4308, r4309:Maxim Dounin1-4/+78
Image filter changes: *) The "image_filter_sharpen" directive. *) Cosmetics. *) Fixed "rotate" to always work when combined with "resize/crop".
2011-12-13Merge of r4217, r4218:Maxim Dounin1-7/+7
Fixed "expires @00h". Fixed "expires @time" with unknown last modified time (ticket #32).
2011-12-13Merge of r4000, r4014, r4265, r4321, r4342, r4343:Maxim Dounin1-309/+0
Infrastructure changes: *) Don't ignore xmllint errors. *) Added missing dependencies for the CHANGES{,ru} targets. Pass string params to xsltproc. *) Ancient incomplete ngx_http_status_module removal. *) Compute the repository root from the checkout. *) Fixed RELEASE target to correctly call "release" one.
2011-12-13Version bump.Maxim Dounin1-1/+1
2011-11-14Merge of r4283:Igor Sysoev1-1/+2
Fix of "Content-Length" header of MP4 response if start argument was used. Patch by Piotr Sikora.
2011-11-14Version bump.Igor Sysoev1-1/+1
2011-11-01Merging r4209:Igor Sysoev1-0/+12
Skipping location rewrite phase for server null location.
2011-11-01Merging r4189, r4197:Igor Sysoev1-1/+8
Perl related fixes: *) Handling of Content-Encoding set from perl. This fixes double gzipping in case of gzip filter being enabled while perl returns already gzipped response. *) Fixed macro name.
2011-11-01Merging r4193, r4194:Igor Sysoev1-23/+52
Autoindex fixes: *) Autoindex: escape '?' in file names. For files with '?' in their names autoindex generated links with '?' not escaped. This resulted in effectively truncated links as '?' indicates query string start. This is an updated version of the patch originally posted at [1]. It introduces generic NGX_ESCAPE_URI_COMPONENT which escapes everything but unreserved characters as per RFC 3986. This approach also renders unneeded special colon processing (as colon is percent-encoded now), it's dropped accordingly. [1] http://nginx.org/pipermail/nginx-devel/2010-February/000112.html *) Autoindex: escape html in file names.
2011-11-01Merging r4158:Igor Sysoev2-2/+20
Added uwsgi_buffering and scgi_buffering directives. Patch by Peter Smit.
2011-11-01Merging r4190, r4232:Igor Sysoev1-1/+1
MP4 related fixes: *) Fixing mp4 module seeking on 32-bit platforms. *) Adding m4a and m4v MIME types (ticket #42).
2011-11-01Merging r4147, r4148, r4149, r4150, r4207:Igor Sysoev3-9/+4
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.
2011-11-01Merging r4132, r4134, r4143, r4183, r4191, r4199:Igor Sysoev3-3/+3
Various fixes related to error messages: *) Removed old warning that suggested to use "server_name_in_redirect off" (now the default) in place of no longer supported "server_name *". *) Fixing directive name in error message if types hash size is not enough. *) Replaced "can not" with "cannot" and "could not" in a bunch of places. Fixed nearby grammar errors. *) Overhauled error messages.
2011-11-01Merging r4034, r4186, r4187, r4229, r4235, r4237:Igor Sysoev1-1/+10
SSL related fixes: *) Better handling of various per-server ssl options with SNI. SSL_set_SSL_CTX() doesn't touch values cached within ssl connection structure, it only changes certificates (at least as of now, OpenSSL 1.0.0d and earlier). As a result settings like ssl_verify_client, ssl_verify_depth, ssl_prefer_server_ciphers are only configurable on per-socket basis while with SNI it should be possible to specify them different for two servers listening on the same socket. Workaround is to explicitly re-apply settings we care about from context to ssl connection in servername callback. Note that SSL_clear_options() is only available in OpenSSL 0.9.8m+. I.e. with older versions it is not possible to clear ssl_prefer_server_ciphers option if it's set in default server for a socket. *) Disabling SSL compression. This saves about 300K per SSL connection. The SSL_OP_NO_COMPRESSION option is available since OpenSSL 1.0.0. *) Releasing memory of idle SSL connection. This saves about 34K per SSL connection. The SSL_MODE_RELEASE_BUFFERS option is available since OpenSSL 1.0.0d. *) Decrease of log level of some SSL handshake errors. *) Fixed segfault on configuration testing with ssl (ticket #37). The following config caused segmentation fault due to conf->file not being properly set if "ssl on" was inherited from the http level: http { ssl on; server { } } *) Silently ignoring a stale global SSL error left after disabled renegotiation.
2011-11-01Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:Igor Sysoev1-1/+1
Miscellaneous fixes: *) Fix of names of the referer hash size directives introduced in r3940. *) Cosmetics: replaced NGX_CONF_TAKE1 to NGX_CONF_FLAG for "sendfile" and "chunked_transfer_encoding" directives, to be in line with all directives taking a boolean argument. Both flags will ensure that a directive takes one argument. *) Improved ngx_parse_time() code readability. *) Preallocating exact number of default MIME types entries. *) Stylistic change in checking the boolean expression. *) Replaced magic constants representing default values of some directives with appropriate #define's. *) Fixed grammar in a comment. *) Fixed two minor bugs in "types" parsing code.
2011-11-01Merging r3992, r4192:Igor Sysoev1-24/+5
access_log related fixes: *) Removal of error message about %name log_format parameters, they have been deleted long ago in 0.5.0-RELEASE. *) Improved access log escaping to better protect other software. Some character sets (notably ISO-8859-1) have C1 control characters in upper half, make sure to escape them.
2011-11-01Version bump.Igor Sysoev1-1/+1
2011-10-01Merging r4089 missed in r4170 merge.Igor Sysoev1-4/+4
2011-10-01Version bump.Igor Sysoev1-1/+1
2011-09-30Merging r4086, r4087, r4088, r4090, r4094, r4095, r4096, r4097, r4099, r4100,Igor Sysoev1-0/+2854
r4106, r4107, r4108, r4113, r4156, r4157: *) ngx_http_mp4_module. *) "video/mp4" mime type added.
2011-09-30Merging r4114, r4129:Igor Sysoev1-31/+68
Buffers reuse in chunked filter. There were 2 buffers allocated on each buffer chain sent through chunked filter (one buffer for chunk size, another one for trailing CRLF, about 120 bytes in total on 32-bit platforms). This resulted in large memory consumption with long-lived requests sending many buffer chains. Usual example of problematic scenario is streaming though proxy with proxy_buffering set to off. Introduced buffers reuse reduces memory consumption in the above problematic scenario. See here for initial report: http://mailman.nginx.org/pipermail/nginx/2010-April/019814.html
2011-09-30Merging r4137:Igor Sysoev1-2/+4
Fixed loss of chain links in fastcgi module.
2011-09-30Merging r4036, r4055, r4056, r4057, r4058, r4059, r4060, r4061, r4062, r4063,Igor Sysoev1-49/+56
r4064: Ranges related fixes: The "max_ranges" directive. "max_ranges 0" disables ranges support at all, "max_ranges 1" allows the single range, etc. By default number of ranges is unlimited, to be precise, 2^31-1. If client requests more ranges than "max_ranges" permits, nginx disables ranges and returns just the source response. If total size of all ranges is greater than source response size, then nginx disables ranges and returns just the source response. This fix should not affect well-behaving applications but will defeat DoS attempts exploiting malicious byte ranges. Now unsatisfiable ranges are processed according to RFC 2616.
2011-09-30Merging r4010, r4065:Igor Sysoev1-2/+1
SSL related fixes: *) Fixing proxy_set_body and proxy_pass_request_body with SSL. Flush flag wasn't set in constructed buffer and this prevented any data from being actually sent to upstream due to SSL buffering. Make sure we always set flush in the last buffer we are going to sent. See here for report: http://nginx.org/pipermail/nginx-ru/2011-June/041552.html *) Proper SSL shutdown handling. If connection has unsent alerts, SSL_shutdown() tries to send them even if SSL_set_shutdown(SSL_RECEIVED_SHUTDOWN|SSL_SENT_SHUTDOWN) was used. This can be prevented by SSL_set_quiet_shutdown(). SSL_set_shutdown() is required nevertheless to preserve session.
2011-09-30Merging r3933, r4154:Igor Sysoev1-0/+2
A new fix for the case when ssl_session_cache defined, but ssl is not enabled in any server. The previous r1033 does not help when unused zone becomes used after reconfiguration, so it is backed out. The initial thought was to make SSL modules independed from SSL implementation and to keep OpenSSL code dependance as much as in separate files.
2011-09-30Version bump.Igor Sysoev1-1/+1
2011-08-29Merge of r4016:Igor Sysoev3-3/+27
Fix ignored headers handling in fastcgi/scgi/uwsgi. The bug had appeared in r3561 (fastcgi), r3638 (scgi), r3567 (uwsgi).