summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-12-21Core: crypt_r() error handling fixed.Maxim Dounin1-14/+13
The crypt_r() function returns NULL on errors, check it explicitly instead of assuming errno will remain 0 if there are no errors (per POSIX, the setting of errno after a successful call to a function is unspecified unless the description of that function specifies that errno shall not be modified). Additionally, dropped unneeded ngx_set_errno(0) and fixed error handling of memory allocation after normal crypt(), which was inapropriate and resulted in null pointer dereference on allocation failures.
2012-12-21Image filter: fixed image_filter rotate inheritance.Maxim Dounin1-9/+15
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.
2012-12-21Geo: ensure that default entry is always present.Ruslan Ermilov1-4/+2
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.
2012-12-21There's no need to normalize address returned by ngx_ptocidr().Ruslan Ermilov1-1/+1
2012-12-20Image filter: configuration inheritance fixes.Maxim Dounin1-10/+18
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.
2012-12-20Brought the link to ngx_http_perl_module documentation up to date.Ruslan Ermilov1-1/+1
2012-12-20Fixed return type of internal function that allocates radix tree nodes.Ruslan Ermilov1-5/+5
2012-12-19Let "add_header" affect 201 responses (ticket #125).Ruslan Ermilov1-0/+1
2012-12-19Slightly optimized code that handles special headers in "add_header".Ruslan Ermilov1-29/+21
2012-12-18Avoid sending "100 Continue" on 413 Request Entity Too Large.Maxim Dounin1-0/+1
Patch by Igor Sysoev.
2012-12-17Added checks that disallow adding a variable with an empty name.Ruslan Ermilov7-6/+32
Added variable name syntax checks to "geo" and "map" directives.
2012-12-17Implemented IPv6 support for URLs specified using domain names.Ruslan Ermilov4-31/+212
This includes "debug_connection", upstreams, "proxy_pass", etc. (ticket #92) To preserve compatibility, "listen" specified with a domain name selects the first IPv4 address, if available. If not available, the first IPv6 address will be used (ticket #186).
2012-12-17Fixed URL parsing code.Ruslan Ermilov1-5/+5
The URL parsing code is not expected to initialize port from default port when in "no_resolve" mode. This got broken in r4671 for the case of IPv6 literals.
2012-12-17Simplified URL parsing code.Ruslan Ermilov1-30/+26
Except for the "listen" directive, "*" specified as a hostname is no longer treated specially.
2012-12-14Geo: fixed the "ranges" without ranges case.Ruslan Ermilov1-15/+18
The following configuration returned an empty value for $geo: geo $geo { ranges; default default; }
2012-12-14Geo: improved ngx_http_geo_block() code readability.Ruslan Ermilov1-3/+2
2012-12-14Fixed handling of ngx_write_fd() and ngx_read_fd() errors.Valentin Bartenev3-6/+6
The ngx_write_fd() and ngx_read_fd() functions return -1 in case of error, so the incorrect comparison with NGX_FILE_ERROR (which is 0 on windows platforms) might result in inaccurate error message in the error log. Also the ngx_errno global variable is being set only if the returned value is -1.
2012-12-14Gzip: fixed zlib memLevel adjusting.Valentin Bartenev1-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.
2012-12-13Upstream: 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.
2012-12-13Fixed variable syntax checking in "set", "geo", "limit_conn_zone",Ruslan Ermilov4-4/+11
and "perl_set" directives.
2012-12-13Proxy: better error message about unexpected data.Maxim Dounin1-1/+2
Requested by Igor Sysoev.
2012-12-12Limit rate: fixed integer overflow in limit calculation (ticket #256).Valentin Bartenev1-1/+1
Patch by Alexey Antropov.
2012-12-10The "auth_basic" directive gained support of variables.Ruslan Ermilov1-47/+36
2012-12-06Allow the complex value to be defined as an empty string.Ruslan Ermilov8-18/+14
This makes conversion from strings to complex values possible without the loss of functionality.
2012-12-06Xslt: prevented infinite loop.Ruslan Ermilov1-2/+2
If XSLT transformation failed and error 500 was handled in the same location, an infinite loop occured that exhausted the stack.
2012-12-03Fixed build with embedded perl in certain setups (ticket #48).Ruslan Ermilov1-14/+3
2012-11-30Fixed the NGX_SOCKADDR_STRLEN macro definition.Ruslan Ermilov1-1/+1
The ngx_sock_ntop() function, when told to print both address and port, prints IPv6 address in square brackets, followed by colon and port.
2012-11-29Core: removed GLOB_NOSORT glob option.Maxim Dounin1-1/+1
This will result in alphabetical sorting of included files if the "include" directive with wildcards is used. Note that the behaviour is now different from that on Windows, where alphabetical sorting is not guaranteed for FindFirsFile()/FindNextFile() (used to be alphabetical on NTFS, but not on FAT). Approved by Igor Sysoev, prodded by many.
2012-11-29Version bump.Maxim Dounin2-3/+3
2012-11-26Gunzip: added missing ngx_http_clear_etag().Maxim Dounin1-0/+1
2012-11-26Core: fixed ngx_write_chain_to_file() with IOV_MAX reached.Maxim Dounin1-0/+1
Catched by dav_chunked.t on Solaris. In released versions this might potentially result in corruption of complex protocol responses if they were written to disk and there were more distinct buffers than IOV_MAX in a single write.
2012-11-26Request body: block write events while reading body.Maxim Dounin1-0/+2
If write events are not blocked, an extra write event might happen for various reasons (e.g. as a result of a http pipelining), resulting in incorrect body being passed to a post handler. The problem manifested itself with the dav module only, as this is the only module which reads the body from a content phase handler (in contrast to exclusive content handlers like proxy). Additionally, dav module used to dump core in such situations due to ticket #238. See reports here: http://mailman.nginx.org/pipermail/nginx-devel/2012-November/002981.html http://serverfault.com/questions/449195/nginx-webdav-server-with-auth-request
2012-11-26Request body: error checking fixes, negative rb->rest handling.Maxim Dounin1-2/+11
Negative rb->rest can't happen with current code, but it's good to have it handled anyway. Found by Coverity (CID 744846, 744847, 744848).
2012-11-26Request body: improved handling of incorrect chunked request body.Maxim Dounin2-5/+16
While discarding chunked request body in some cases after detecting request body corruption no error was returned, while it was possible to correctly return 400 Bad Request. If error is detected too late, make sure to properly close connection. Additionally, in ngx_http_special_response_handler() don't return body of 500 Internal Server Error to a client if ngx_http_discard_request_body() fails, but disable keepalive and continue.
2012-11-26Request body: fixed discard of chunked request body.Maxim Dounin1-1/+1
Even if there is no preread data, make sure to always call ngx_http_discard_request_body_filter() in case of chunked request body to initialize r->headers_in.content_length_n for later use.
2012-11-23Core: don't reuse shared memory zone that changed ownership (ticket #210).Ruslan Ermilov1-1/+3
nginx doesn't allow the same shared memory zone to be used for different purposes, but failed to check this on reconfiguration. If a shared memory zone was used for another purpose in the new configuration, nginx attempted to reuse it and crashed.
2012-11-21Fixed location of debug message in ngx_shmtx_lock().Ruslan Ermilov1-3/+3
2012-11-21Request body: unbreak build without debug.Maxim Dounin1-0/+2
2012-11-21Request body: chunked transfer encoding support.Maxim Dounin4-179/+548
2012-11-21Request body: recalculate size of a request body in scgi module.Maxim Dounin1-10/+16
This allows to handle requests with chunked body by scgi module, and also simplifies handling of various request body modifications.
2012-11-21Request body: $content_length variable to honor real body size.Maxim Dounin1-2/+37
This allows to handle requests with chunked body by fastcgi and uwsgi modules, and also simplifies handling of various request body modifications.
2012-11-21Request body: always use calculated size of a request body in proxy.Maxim Dounin1-16/+11
This allows to handle requests with chunked body, and also simplifies handling of various request body modifications.
2012-11-21Request body: adjust b->pos when chunked parsing done.Maxim Dounin1-0/+3
This is a nop for the current code, though will allow to correctly parse pipelined requests.
2012-11-21Request body: chunked parsing moved to ngx_http_parse.c from proxy.Maxim Dounin3-276/+277
No functional changes.
2012-11-21Request body: properly handle events while discarding body.Maxim Dounin1-7/+9
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-11-21Request body: fixed socket leak on errors.Maxim Dounin1-10/+28
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.
2012-11-21Request body: code duplication reduced, no functional changes.Maxim Dounin1-25/+14
The r->request_body_in_file_only with empty body case is now handled in ngx_http_write_request_body().
2012-11-21Request body: $request_body variable generalization.Maxim Dounin1-5/+13
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.
2012-11-21Request body: fixed "501 Not Implemented" error handling.Maxim Dounin2-3/+4
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.
2012-11-21Core: added debug logging of writev() in ngx_write_chain_to_file().Maxim Dounin1-0/+3