summaryrefslogtreecommitdiffhomepage
path: root/src/http (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-03-29Merge of r5133, r5134: peer.free() and peer.get() balance.Maxim Dounin4-26/+11
*) Upstream: only call peer.free() if peer.get() selected a peer. *) Upstream: removed double-free workarounds in peer.free() methods.
2013-03-29Merge of r5129: split clients configuration parsing.Maxim Dounin1-1/+1
Split clients: check length when parsing configuration.
2013-03-29Merge of r5127: language in a comment.Maxim Dounin1-5/+5
Fixed language in a comment preceding ngx_http_index_handler().
2013-03-29Merge of r5113, r5114: upstream: resolve errors handling.Maxim Dounin1-2/+8
Upstream: call ngx_http_run_posted_requests() on resolve errors. If proxy_pass to a host with dynamic resolution was used to handle a subrequest, and host resolution failed, the main request wasn't run till something else happened on the connection. E.g. request to "/zzz" with the following configuration hanged: addition_types *; resolver 8.8.8.8; location /test { set $ihost xxx; proxy_pass http://$ihost; } location /zzz { add_after_body /test; return 200 "test"; } Report and original version of the patch by Lanshun Zhou, http://mailman.nginx.org/pipermail/nginx-devel/2013-March/003476.html.
2013-03-29Merge of r5109, r5128: removed unused prototype and macro.Maxim Dounin2-4/+0
*) Removed unused prototype of ngx_http_find_server_conf(). This function prototype and its implementation was added in r90, but the implementation was removed in r97. *) Removed unused ngx_http_clear_variable() macro.
2013-03-29Merge of r5098: mp4: fixed handling of too small mdat atoms.Maxim Dounin1-0/+7
Mp4: fixed handling of too small mdat atoms (ticket #266). Patch by Gernot Vormayr (with minor changes).
2013-03-29Merge of r5083: fixed potential segfault in keepalive handler.Maxim Dounin1-0/+1
Fixed potential segfault in ngx_http_keepalive_handler(). In case of error in the read event handling we close a connection by calling ngx_http_close_connection(), that also destroys connection pool. Thereafter, an attempt to free a buffer (added in r4892) that was allocated from the pool could cause SIGSEGV and is meaningless as well (the buffer already freed with the pool).
2013-03-29Merge of r5078: removed zero termination of shm zone names.Maxim Dounin2-3/+0
It was added in r2717 and no longer needed since r2721, where the termination was added to ngx_shm_alloc() and ngx_init_zone_pool(). Since then it only corrupted error messages about invalid zones.
2013-03-29Merge of r5070: fixed false memset warning on Linux.Maxim Dounin1-2/+5
Fixed false memset warning on Linux with -O3 (ticket #275). Prodded by John Leach.
2013-03-29Version bump.Maxim Dounin1-1/+1
2013-02-11Merge of r5027, r5028, r5029: fastcgi_keep_conn fixes.Maxim Dounin1-58/+43
*) FastCGI: fixed wrong connection close with fastcgi_keep_conn. With fastcgi_keep_conn it was possible that connection was closed after FCGI_STDERR record with zero padding and without any further data read yet. This happended as f->state was set to ngx_http_fastcgi_st_padding and then "break" happened, resulting in p->length being set to f->padding, i.e. 0 (which in turn resulted in connection close). Fix is to make sure we continue the loop after f->state is set. *) FastCGI: unconditional state transitions. Checks for f->padding before state transitions make code hard to follow, remove them and make sure we always do another loop iteration after f->state is set to ngx_http_fastcgi_st_padding. *) FastCGI: proper handling of split fastcgi end request. If fastcgi end request record was split between several network packets, with fastcgi_keep_conn it was possible that connection was saved in incorrect state (e.g. with padding bytes not yet read).
2013-02-11Merge of r5018: secure link: fixed configuration inheritance.Maxim Dounin1-2/+15
The "secure_link_secret" directive was always inherited from the outer configuration level even when "secure_link" and "secure_link_md5" were specified on the inner level.
2013-02-11Merge of r5014, r5015, r5016, r5030: geoip ipv6 support.Maxim Dounin1-15/+145
*) Configure: fixed style of include directories. *) Configure: fixed GeoIP library detection. *) GeoIP: IPv6 support. When using IPv6 databases, IPv4 addresses are looked up as IPv4-mapped IPv6 addresses. Mostly based on a patch by Gregor Kališnik (ticket #250). *) GeoIP: removed pseudo-support of "proxy" and "netspeed" databases.
2013-02-11Merge of r5013: proxy: fixed proxy_method to always add space.Maxim Dounin1-4/+5
Before the patch if proxy_method was specified at http{} level the code to add trailing space wasn't executed, resulting in incorrect requests to upstream.
2013-02-11Merge of r4999, r5003: detect duplicate "events" and "keepalive".Maxim Dounin1-0/+4
*) Upstream keepalive: detect duplicate "keepalive" directive. A failure to detect duplicate "keepalive" directive resulted in stack exhaustion. *) Events: added check for duplicate "events" directive.
2013-02-11Merge of r4992: off-by-one with 32/64 upstream backup servers.Maxim Dounin2-2/+6
Fixed off-by-one during upstream state resetting when switching to backup servers if there were exactly 32 (64 on 64-bit platforms) backup servers configured. Based on patch by Thomas Chen (ticket #257).
2013-02-11Merge of r4991: fixed proxied HEAD requests with gzip enabled.Maxim Dounin2-1/+2
Fixed HEAD requests handling when proxying is used (ticket #261).
2013-02-11Merge of r4985, r4986, r4987, r4988, r4989, r5002: access_log gzip.Maxim Dounin1-40/+378
*) Access log: fixed redundant buffer reallocation. Previously a new buffer was allocated for every "access_log" directive with the same file path and "buffer=" parameters, while only one buffer per file is used. *) Reopening log files code moved to a separate function. The code refactored in a way to call custom handler that can do appropriate cleanup work (if any), like flushing buffers, finishing compress streams, finalizing connections to log daemon, etc.. *) Access log: the "flush" parameter of the "access_log" directive. *) Configure: added the NGX_ZLIB define. This was introduced for conditional compilation of the code that requires the zlib library. *) Access log: the "gzip" parameter of the "access_log" directive. Note: this requires zlib version 1.2.0.4 or above to work. *) The data pointer in ngx_open_file_t objects must be initialized. Uninitialized pointer may result in arbitrary segfaults if access_log is used without buffer and without variables in file path. Patch by Tatsuhiko Kubo (ticket #268).
2013-02-11Merge of r4979, r4982: image filter configuration inheritance.Maxim Dounin1-13/+27
*) Image filter: configuration inheritance fixes. The image_filter_jpeg_quality, image_filter_sharpen and "image_filter rotate" were inherited incorrectly if a directive with variables was defined, and then redefined to a literal value, i.e. in configurations like image_filter_jpeg_quality $arg_q; location / { image_filter_jpeg_quality 50; } Patch by Ian Babrou, with minor changes. *) Image filter: fixed image_filter rotate inheritance. Configurations like location /i/ { image_filter resize 200 200; image_filter rotate 180; location /i/foo/ { image_filter resize 200 200; } } resulted in rotation incorrectly applied in the location /i/foo, without any way to clear it. Fix is to handle conf->angle/conf->acv consistently with other filter variables and do not try to inherit them if there are transformations defined for current location.
2013-02-11Merge of r4976: let add_header affect 201 responses (ticket #125).Maxim Dounin1-0/+1
2013-02-11Merge of r4974: avoid sending "100 Continue" on 413.Maxim Dounin1-0/+1
Avoid sending "100 Continue" on 413 Request Entity Too Large. Patch by Igor Sysoev.
2013-02-11Merge of r4993, r4994, r4997, r5000: geo ipv6 support.Maxim Dounin1-88/+281
*) Geo: IPv6 support. The "ranges" mode is still limited to IPv4 only. *) Geo: properly initialize ngx_cidr_t when dealing with "default". *) Geo: made "default" affect both IPv4 and IPv6 when using prefixes. Previously, "default" was equivalent to specifying 0.0.0.0/0, now it's equivalent to specifying both 0.0.0.0/0 and ::/0 (if support for IPv6 is enabled) with the same value. *) Geo: improved code readability.
2013-02-11Merge of r4968, r4969, r4977, r4980, r4981, r4990: geo fixes.Maxim Dounin1-23/+23
*) Geo: improved ngx_http_geo_block() code readability. *) Geo: fixed the "ranges" without ranges case. The following configuration returned an empty value for $geo: geo $geo { ranges; default default; } *) Fixed return type of internal function that allocates radix tree nodes. *) There's no need to normalize address returned by ngx_ptocidr(). *) Geo: ensure that default entry is always present. If 0.0.0.0/32 entry was present and there was no explicit "default", we failed to add an empty string as a default value. *) Trailing whitespace fix.
2013-02-10Merge of r4966: gzip: fixed zlib memLevel adjusting.Maxim Dounin1-0/+4
An incorrect memLevel (lower than 1) might be passed to deflateInit2() if the "gzip_hash" directive is set to a value less than the value of "gzip_window" directive. This resulted in "deflateInit2() failed: -2" alert and an empty reply.
2013-02-10Merge of r4965: upstream: fixed SIGSEGV with the "if" directive.Maxim Dounin1-0/+8
Configuration like location / { set $true 1; if ($true) { proxy_pass http://backend; } if ($true) { # nothing } } resulted in segmentation fault due to NULL pointer dereference as the upstream configuration wasn't initialized in an implicit location created by the last if(), but the r->content_handler was set due to first if(). Instead of committing a suicide by dereferencing a NULL pointer, return 500 (Internal Server Error) in such cases, i.e. if uscf is NULL. Better fix would be to avoid such cases by fixing the "if" directive handling, but it's out of scope of this patch. Prodded by Piotr Sikora.
2013-02-10Merge of r4963: proxy: better error message about unexpected data.Maxim Dounin1-1/+2
Requested by Igor Sysoev.
2013-02-10Merge of r4962: limit_rate fix.Maxim Dounin1-1/+1
Limit rate: fixed integer overflow in limit calculation (ticket #256). Patch by Alexey Antropov.
2013-02-10Merge of r4948, r4949, r4964, r4973, r5011: variables.Maxim Dounin12-65/+185
*) Allow the complex value to be defined as an empty string. This makes conversion from strings to complex values possible without the loss of functionality. *) The "auth_basic" directive gained support of variables. *) Fixed variable syntax checking in "set", "geo", "limit_conn_zone", and "perl_set" directives. *) Added checks that disallow adding a variable with an empty name. Added variable name syntax checks to "geo" and "map" directives. *) Variables $pipe, $request_length, $time_iso8601, and $time_local. Log module counterparts are preserved for efficiency. Based on patch by Kiril Kalchev.
2013-02-10Merge of r4947: xslt: prevented infinite loop.Maxim Dounin1-2/+2
If XSLT transformation failed and error 500 was handled in the same location, an infinite loop occured that exhausted the stack.
2013-02-10Merge of r4946, r4978: perl.Maxim Dounin2-15/+4
*) Fixed build with embedded perl in certain setups (ticket #48). *) Brought the link to ngx_http_perl_module documentation up to date.
2013-02-09Version bump.Maxim Dounin1-1/+1
2012-12-11Merge of r4921, r4922, r4923, r4924, r4925: request body fixes.Maxim Dounin4-50/+68
*) Request body: fixed "501 Not Implemented" error handling. It is not about "Method" but a generic message, and is expected to be used e.g. if specified Transfer-Encoding is not supported. Fixed message to match RFC 2616. Additionally, disable keepalive on such errors as we won't be able to read request body correctly if we don't understand Transfer-Encoding used. *) Request body: $request_body variable generalization. The $request_body variable was assuming there can't be more than two buffers. While this is currently true due to request body reading implementation details, this is not a good thing to depend on and may change in the future. *) Request body: code duplication reduced, no functional changes. The r->request_body_in_file_only with empty body case is now handled in ngx_http_write_request_body(). *) Request body: fixed socket leak on errors. The r->main->count reference counter was always incremented in ngx_http_read_client_request_body(), while it is only needs to be incremented on positive returns. *) Request body: properly handle events while discarding body. An attempt to call ngx_handle_read_event() before actually reading data from a socket might result in read event being disabled, which is wrong. Catched by body.t test on Solaris.
2012-12-10Merge of r4919: fixed segfault on PUT in dav module.Maxim Dounin1-0/+5
Dav: fixed segfault on PUT if body was already read (ticket #238). If request body reading happens with different options it's possible that there will be no r->request_body->temp_file available (or even no r->request_body available if body was discarded). Return internal server error in this case instead of committing suicide by dereferencing a null pointer.
2012-12-10Merge of r4915, r4916, r4917: upstream minor fixes.Maxim Dounin2-2/+13
*) Upstream: honor the "down" flag for a single server. If an upstream block was defined with the only server marked as "down", e.g. upstream u { server 127.0.0.1:8080 down; } an attempt was made to contact the server despite the "down" flag. It is believed that immediate 502 response is better in such a case, and it's also consistent with what is currently done in case of multiple servers all marked as "down". *) Upstream: better detection of connect() failures with kqueue. Pending EOF might be reported on both read and write events, whichever comes first, so check both of them. Patch by Yichun Zhang (agentzh), slightly modified.
2012-12-10Merge of r4914: variables $request_time and $msec.Maxim Dounin1-0/+63
Log module counterparts are preserved for efficiency.
2012-12-10Version bump.Maxim Dounin1-1/+1
2012-11-13Merge of r4896: event pipe: fixed handling of buf_to_file data.Maxim Dounin1-0/+1
Input filter might free a buffer if there is no data in it, and in case of first buffer (used for cache header and request header, aka p->buf_to_file) this resulted in cache corruption. Buffer memory was reused to read upstream response before headers were written to disk. Fix is to avoid moving pointers in ngx_event_pipe_add_free_buf() to a buffer start if we were asked to free a buffer used by p->buf_to_file. This fixes occasional cache file corruption, usually resulted in "cache file ... has md5 collision" alerts. Reported by Anatoli Marinov.
2012-11-13Merge of r4892: keepalive memory usage optimization.Maxim Dounin1-0/+14
The ngx_http_keepalive_handler() function is now trying to not keep c->buffer's memory for idle connections. This behaviour is consistent with the ngx_http_set_keepalive() function and it should decrease memory usage in some cases (especially if epoll/rtsig is used).
2012-11-13Merge of r4886, r4887, r4894: log variables generalization:Maxim Dounin2-31/+79
*) Log: $apache_bytes_sent removed. It was renamed to $body_bytes_sent in nginx 0.3.10 and the old name is deprecated since then. *) Variable $bytes_sent. It replicates variable $bytes_sent as previously available in log module only. Patch by Benjamin Grössing (with minor changes). *) Variables $connection and $connection_requests. Log module counterparts are removed as they aren't used often and there is no need to preserve them for efficiency.
2012-11-13Merge of r4885: ssl_verify_client optional_no_ca.Maxim Dounin2-2/+5
SSL: the "ssl_verify_client" directive parameter "optional_no_ca". This parameter allows to don't require certificate to be signed by a trusted CA, e.g. if CA certificate isn't known in advance, like in WebID protocol. Note that it doesn't add any security unless the certificate is actually checked to be trusted by some external means (e.g. by a backend). Patch by Mike Kazantsev, Eric O'Connor.
2012-11-12Version bump.Maxim Dounin1-1/+1
2012-09-24Merge of r4833: limit req: fix of rbtree node insertion.Maxim Dounin1-4/+4
Limit req: fix of rbtree node insertion on hash collisions. The rbtree used in ngx_http_limit_req_module has two level of keys, the top is hash, and the next is the value string itself. However, when inserting a new node, only hash has been set, while the value string has been left empty. The bug was introduced in r4419 (1.1.14). Found by Charles Chen.
2012-09-24Merge of r4829: fixed strict aliasing with ipv6 (ticket #201).Maxim Dounin3-3/+29
Fixed strict aliasing bugs when dealing with IPv4-mapped IPv6 addresses.
2012-09-24Merge of r4828: "include" with wildcards in map and types blocks.Maxim Dounin2-19/+4
The "include" directive should be able to include multiple files if given a filename mask. Fixed this to work for "include" directives inside the "map" or "types" blocks. The "include" directive inside the "geo" block is still not fixed.
2012-09-24Merge of r4817: geo: fixed handling of ranges without default set.Maxim Dounin1-4/+4
The bug had appeared in 0.8.43 (r3653). Patch by Weibin Yao.
2012-09-24Merge of r4815: map: fixed optimization of variables as values.Maxim Dounin1-8/+2
Previous code incorrectly used ctx->var_values as an array of pointers to ngx_http_variable_value_t, but the array contains structures, not pointers. Additionally, ctx->var_values inspection failed to properly set var on match.
2012-09-24Merge of r4785, r4795, r4811, r4812, r4816, r4822: coverity.Maxim Dounin4-0/+11
*) Resolver: fixed possible memory leak in ngx_resolver_create(). *) Explicitly ignore returned value from unlink() in ngx_open_tempfile(). *) Explicitly ignore returned value from close() in ngx_event_core_init_conf(). *) Added three missing checks for NULL after ngx_array_push() calls. *) Crypt: fixed handling of corrupted SSHA entries in password file. *) Mark logically dead code with corresponding comment. Found by / prodded by Coverity.
2012-09-24Merge of r4778, r4782, r4783, r4824, r4830, r4834: minor fixes.Maxim Dounin1-11/+7
*) Reorder checks in ngx_shared_memory_add() for more consistent error messages. *) Added "const" to ngx_memcpy() with NGX_MEMCPY_LIMIT defined. This fixes warning produced during compilation of the ngx_http_geoip_module due to const qualifier being discarded. *) Fixed possible use of old cached times if runtime went backwards. If ngx_time_sigsafe_update() updated only ngx_cached_err_log_time, and then clock was adjusted backwards, the cached_time[slot].sec might accidentally match current seconds on next ngx_time_update() call, resulting in various cached times not being updated. Fix is to clear the cached_time[slot].sec to explicitly mark cached times are stale and need updating. *) Radix tree preallocation fix. The preallocation size was calculated incorrectly and was always 8 due to sizeof(ngx_radix_tree_t) accidentally used instead of sizeof(ngx_radix_node_t). *) Fixed overflow if ngx_slab_alloc() is called with very big "size" argument. *) Write filter: replaced unneeded loop with one to free chains. Noted by Gabor Lekeny.
2012-09-24Version bump.Maxim Dounin1-1/+1
2012-08-06Merge of r4771: ngx_http_find_virtual_server() fix.Maxim Dounin1-1/+1
The ngx_http_find_virtual_server() function should return NGX_DECLINED if virtual server not found.