aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_request.c
Commit message (Collapse)AuthorAge
...
* Apply server configuration as soon as host is known.Valentin Bartenev2013-02-27
| | | | | | | | | | | | | | | | | | Previously, this was done only after the whole request header was parsed, and if an error occurred earlier then the request was processed in the default server (or server chosen by SNI), while r->headers_in.server might be set to the value from the Host: header or host from request line. r->headers_in.server is in turn used for $host variable and in HTTP redirects if "server_name_in_redirect" is disabled. Without the change, configurations that rely on this during error handling are potentially unsafe if SNI is used. This change also allows to use server specific settings of "underscores_in_headers", "ignore_invalid_headers", and "large_client_header_buffers" directives for HTTP requests and HTTPS requests without SNI.
* SSL: do not treat SSL handshake as request.Valentin Bartenev2013-02-27
| | | | | | | | | | | | | | | | | | The request object will not be created until SSL handshake is complete. This simplifies adding another connection handler that does not need request object right after handshake (e.g., SPDY). There are also a few more intentional effects: - the "client_header_buffer_size" directive will be taken from the server configuration that was negotiated by SNI; - SSL handshake errors and timeouts are not logged into access log as bad requests; - ngx_ssl_create_connection() is not called until the first byte of ClientHello message was received. This also decreases memory consumption if plain HTTP request is sent to SSL socket.
* Status: do not count connection as reading right after accept().Valentin Bartenev2013-02-27
| | | | | | | Before we receive the first bytes, the connection is counted as waiting. This change simplifies further code changes.
* SNI: reuse selected configuration for all requests in a connection.Valentin Bartenev2013-02-27
| | | | | | | | | | | | | | | | | | Previously, only the first request in a connection was assigned the configuration selected by SNI. All subsequent requests initially used the default server's configuration, ignoring SNI, which was wrong. Now all subsequent requests in a connection will initially use the configuration selected by SNI. This is done by storing a pointer to configuration in http connection object. It points to default server's configuration initially, but changed upon receipt of SNI. (The request's configuration can be further refined when parsing the request line and Host: header.) This change was not made specific to SNI as it also allows slightly faster access to configuration without the request object.
* SNI: ignore captures in server_name regexes when matching by SNI.Valentin Bartenev2013-02-27
| | | | | | | | This change helps to decouple ngx_http_ssl_servername() from the request object. Note: now we close connection in case of error during server name lookup for request. Previously, we did so only for HTTP/0.9 requests.
* Changed interface of ngx_http_validate_host().Valentin Bartenev2013-02-27
|
* Introduced the ngx_http_set_connection_log() macro.Valentin Bartenev2013-02-27
| | | | No functional changes.
* The default server lookup is now done only once per connection.Valentin Bartenev2013-02-27
| | | | Previously, it was done for every request in a connection.
* Correctly handle multiple X-Forwarded-For headers (ticket #106).Ruslan Ermilov2013-02-27
|
* Fixed potential segfault in ngx_http_keepalive_handler().Valentin Bartenev2013-02-23
| | | | | | | | 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).
* Proxy: support for connection upgrade (101 Switching Protocols).Maxim Dounin2013-02-18
| | | | | | | | | | | | | | This allows to proxy WebSockets by using configuration like this: location /chat/ { proxy_pass http://backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } Connection upgrade is allowed as long as it was requested by a client via the Upgrade request header.
* Request body: chunked transfer encoding support.Maxim Dounin2012-11-21
|
* ngx_http_keepalive_handler() is now trying to not keep c->buffer's memory forValentin Bartenev2012-10-23
| | | | | | | 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).
* SSL: the "ssl_verify_client" directive parameter "optional_no_ca".Maxim Dounin2012-10-03
| | | | | | | | | | | 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.
* ngx_http_find_virtual_server() should return NGX_DECLINED if virtual server notValentin Bartenev2012-07-30
| | | | found.
* Entity tags: basic support in not modified filter.Maxim Dounin2012-07-07
| | | | | | | | | | | This includes handling of ETag headers (if present in a response) with basic support for If-Match, If-None-Match conditionals in not modified filter. Note that the "r->headers_out.last_modified_time == -1" check in the not modified filter is left as is intentionally. It's to prevent handling of If-* headers in case of proxy without cache (much like currently done with If-Modified-Since).
* Corrected $request_length calculation for pipelined requests.Andrey Belov2012-07-06
|
* Fixed compile-time conditionals used to detect if X-Forwarded-For supportRuslan Ermilov2012-06-21
| | | | is needed.
* Win32: uris with ":$" are now rejected.Maxim Dounin2012-06-05
| | | | | | | | | There are too many problems with special NTFS streams, notably "::$data", "::$index_allocation" and ":$i30:$index_allocation". For now we don't reject all URIs with ":" like Apache does as there are no good reasons seen yet, and there are multiple programs using it in URLs (e.g. MediaWiki).
* Fixed segfault with filter_finalize introduced in r4621 (1.3.0).Maxim Dounin2012-05-17
| | | | | | | | | | | | | | | | | | Example configuration to reproduce: location /image/ { error_page 415 = /zero; image_filter crop 100 100; proxy_pass http://127.0.0.1:8080; proxy_store on; } location /zero { return 204; } The problem appeared if upstream returned (big enough) non-image file, causing 415 to be generated by image filter.
* Fixed possible request hang with filter finalization.Maxim Dounin2012-05-14
| | | | | | | | | | | | With r->filter_finalize set the ngx_http_finalize_connection() wasn't called from ngx_http_finalize_request() called with NGX_OK, resulting in r->main->count not being decremented, thus causing request hang in some rare situations. See here for more details: http://mailman.nginx.org/pipermail/nginx-devel/2012-May/002190.html Patch by Yichun Zhang (agentzh).
* Removed surplus condition.Valentin Bartenev2012-04-27
|
* Fixed log->action after ssl handshake.Maxim Dounin2012-04-16
|
* Fixed grammar in error messages.Ruslan Ermilov2012-04-12
|
* Restricted keepalive_disable safari to OS X only.Maxim Dounin2012-03-22
| | | | | | | The problem doesn't affect non-Apple systems for sure, and many pretend to be Safari now. Prodded by Piotr Sikora.
* Core: protection from cycles with named locations and post_action.Maxim Dounin2012-02-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now redirects to named locations are counted against normal uri changes limit, and post_action respects this limit as well. As a result at least the following (bad) configurations no longer trigger infinite cycles: 1. Post action which recursively triggers post action: location / { post_action /index.html; } 2. Post action pointing to nonexistent named location: location / { post_action @nonexistent; } 3. Recursive error page for 500 (Internal Server Error) pointing to a nonexistent named location: location / { recursive_error_pages on; error_page 500 @nonexistent; return 500; }
* Core: protection from subrequest loops.Maxim Dounin2012-02-13
| | | | | | | | | | | | Without the protection, subrequest loop results in r->count overflow and SIGSEGV. Protection was broken in 0.7.25. Note that this also limits number of parallel subrequests. This wasn't exactly the case before 0.7.25 as local subrequests were completed directly. See here for details: http://nginx.org/pipermail/nginx-ru/2010-February/032184.html
* Copyright updated.Maxim Konovalov2012-01-18
|
* Added support for IP-literal in the Host header and request line (ticket #1).Valentin Bartenev2011-11-28
| | | | | | | | | | | | | | | | | | | | Additional parsing logic added to correctly handle RFC 3986 compliant IPv6 and IPvFuture characters enclosed in square brackets. The host validation was completely rewritten. The behavior for non IP literals was changed in a more proper and safer way: - Host part is now delimited either by the first colon or by the end of string if there's no colon. Previously the last colon was used as delimiter which allowed substitution of a port number in the $host variable. (e.g. Host: 127.0.0.1:9000:80) - Fixed stripping of the ending dot in the Host header when the host was also followed by a port number. (e.g. Host: nginx.com.:80) - Fixed upper case characters detection. Previously it was broken which led to wasting memory and CPU.
* Fixed segfault on ssl servers without cert with SNI (ticket #54).Maxim Dounin2011-11-22
| | | | | | Non-default servers may not have ssl context created if there are no certificate defined. Make sure to check if ssl context present before using it.
* Fix for socket leak with "aio sendfile" and "limit_rate".Maxim Dounin2011-10-11
| | | | | | | | | | | | | | | Second aio post happened when timer set by limit_rate expired while we have aio request in flight, resulting in "second aio post" alert and socket leak. The patch adds actual protection from aio calls with r->aio already set to aio sendfile code in ngx_http_copy_filter(). This should fix other cases as well, e.g. when sending buffered to disk upstream replies while still talking to upstream. The ngx_http_writer() is also fixed to handle the above case (though it's mostly optimization now). Reported by Oleksandr V. Typlyns'kyi.
* Fix for connection drops with AIO.Maxim Dounin2011-10-11
| | | | | Connections serving content with AIO to fast clients were dropped with "client timed out" messages after send_timeout from response start.
* Better handling of various per-server ssl options with SNI.Maxim Dounin2011-08-23
| | | | | | | | | | | | | | | | | | 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.
* always set timer in discard body handler, this fixes the casesIgor Sysoev2011-08-01
| | | | | | when request for static file is redirected by error_page to an SSI page patch by Maxim Dounin
* lingering_close "off|on|always"Igor Sysoev2011-08-01
| | | | patch by Maxim Dounin
* do not send RST on normal lingering close read timeout,Igor Sysoev2011-08-01
| | | | | | if reset_timedout_connection is on patch by Maxim Dounin
* enable lingering close for pipelined requestsIgor Sysoev2011-08-01
| | | | patch by Maxim Dounin
* Accept-Encoding refactoring: remove ancient MSIE 4.x test for gzipIgor Sysoev2011-07-30
|
* reuse keepalive connections if there are no free worker connectionsIgor Sysoev2011-04-04
| | | | patch by Maxim Dounin
* introduce 494 code "Request Header Too Large"Igor Sysoev2011-01-20
|
* "If-Unmodified-Since" supportIgor Sysoev2010-12-06
|
* fix recognition of SSLv2 Client Hello Packet large than 255 bytesIgor Sysoev2010-07-05
|
* allow spaces in URIIgor Sysoev2010-06-15
|
* test default NTFS stream "::$DATA"Igor Sysoev2010-06-04
|
* disable keepalive for Safari:Igor Sysoev2010-02-01
| | | | https://bugs.webkit.org/show_bug.cgi?id=5760
* skip URI trailing spaces under Win32Igor Sysoev2010-01-28
|
* Fix segfault when while discarding body a write event handler is called,Igor Sysoev2010-01-28
| | | | | | runs ngx_http_core_run_phases(), and starts a request processing again. The write event has clear type and remained in a keepalive connection. The bug was introduced in r3050.
* regex named capturesIgor Sysoev2009-11-16
|
* r->chromeIgor Sysoev2009-11-12
|
* fix segfault if there is single large_client_header_buffersIgor Sysoev2009-11-03
| | | | and a request line fills it completely