summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-03-25Use NGX_FILE_ERROR for handling file operations errors.Valentin Bartenev5-7/+9
On Win32 platforms 0 is used to indicate errors in file operations, so comparing against -1 is not portable. This was not much of an issue in patched code, since only ngx_fd_info() test is actually reachable on Win32 and in worst case it might result in bogus error log entry. Patch by Piotr Sikora.
2013-03-25Upstream: removed rudiments of upstream connection caching.Ruslan Ermilov2-23/+0
This functionality is now provided by ngx_http_upstream_keepalive_module.
2013-03-25Upstream: removed sorting of upstream servers.Ruslan Ermilov1-22/+0
Sorting of upstream servers by their weights is not required by current balancing algorithms. This will likely change mapping to backends served by ip_hash weighted upstreams.
2013-03-25Mail: IPv6 backends (ticket #323).Ruslan Ermilov1-24/+35
2013-03-25Upstream: removed double-free workarounds in peer.free() methods.Ruslan Ermilov3-19/+1
2013-03-25Upstream: only call peer.free() if peer.get() selected a peer.Ruslan Ermilov1-7/+10
2013-03-21Split clients: check length when parsing configuration.Ruslan Ermilov1-1/+1
2013-03-21Removed unused ngx_http_clear_variable() macro.Ruslan Ermilov1-3/+0
2013-03-21Fixed language in a comment preceding ngx_http_index_handler().Ruslan Ermilov1-5/+5
2013-03-21Moved ngx_array_t definition from ngx_core.h to ngx_array.h.Ruslan Ermilov2-3/+2
2013-03-21Use NGX_DEFAULT_POOL_SIZE macro where appropriate.Ruslan Ermilov4-5/+5
2013-03-21Simplified ngx_array_create().Ruslan Ermilov1-7/+1
2013-03-20Core: fixed resource leak if binary upgrade fails due to no memory.Ruslan Ermilov1-0/+1
Found by Coverity (CID 992320).
2013-03-20Preliminary experimental support for SPDY draft 2.Valentin Bartenev15-14/+4823
2013-03-20Win32: disabled MSVC warning about '\0' not fitting into array.Valentin Bartenev1-0/+3
We believe that this warning produces more inconvience than real benefit. Here is an example to trigger: u_char a[4] = "test";
2013-03-20URI processing code moved to a separate function.Valentin Bartenev1-120/+125
This allows to reuse it in the upcoming SPDY module.
2013-03-19Image filter: the "image_filter_interlace" directive.Ruslan Ermilov1-0/+13
Patch by Ian Babrou, with minor changes.
2013-03-18The limit_req_status and limit_conn_status directives.Maxim Dounin2-3/+36
Patch by Nick Marden, with minor changes.
2013-03-18Core: guard against failed allocation during binary upgrade.Ruslan Ermilov1-0/+3
Patch by Piotr Sikora.
2013-03-15Status: introduced the "ngx_stat_waiting" counter.Valentin Bartenev4-3/+24
And corresponding variable $connections_waiting was added. Previously, waiting connections were counted as the difference between active connections and the sum of reading and writing connections. That made it impossible to count more than one request in one connection as reading or writing (as is the case for SPDY). Also, we no longer count connections in handshake state as waiting.
2013-03-15Allow to reuse connections that wait their first request.Valentin Bartenev1-0/+19
This should improve behavior under deficiency of connections. Since SSL handshake usually takes significant amount of time, we exclude connections from reusable queue during this period to avoid premature flush of them.
2013-03-14Upstream: fixed previous commit.Maxim Dounin1-1/+3
Store r->connection on stack to make sure it's still available if request finalization happens to actually free request memory.
2013-03-14Upstream: call ngx_http_run_posted_requests() on resolve errors.Maxim Dounin1-2/+6
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-14Request body: avoid linking rb->buf to r->header_in.Maxim Dounin1-1/+14
Code to reuse of r->request_body->buf in upstream module assumes it's dedicated buffer, hence after 1.3.9 (r4931) it might reuse r->header_in if client_body_in_file_only was set, resulting in original request corruption. It is considered to be safer to always create a dedicated buffer for rb->bufs to avoid such problems.
2013-03-14Request body: next upstream fix.Maxim Dounin1-2/+2
After introduction of chunked request body handling in 1.3.9 (r4931), r->request_body->bufs buffers have b->start pointing to original buffer start (and b->pos pointing to real data of this particular buffer). While this is ok as per se, it caused bad things (usually original request headers included before the request body) after reinit of the request chain in ngx_http_upstream_reinit() while sending the request to a next upstream server (which used to do b->pos = b->start for each buffer in the request chain). Patch by Piotr Sikora.
2013-03-12Fixed logging in ngx_http_wait_request_handler().Maxim Dounin1-1/+1
If c->recv() returns 0 there is no sense in using ngx_socket_errno for logging, its value meaningless. (The code in question was copied from ngx_http_keepalive_handler(), but ngx_socket_errno makes sense there as it's used as a part of ECONNRESET handling, and the c->recv() call is preceeded by the ngx_set_socket_errno(0) call.)
2013-03-11Removed unused prototype of ngx_http_find_server_conf().Valentin Bartenev1-1/+0
This function prototype and its implementation was added in r90, but the implementation was removed in r97.
2013-03-11Gzip: fixed setting of NGX_HTTP_GZIP_BUFFERED.Valentin Bartenev1-0/+2
In r2411 setting of NGX_HTTP_GZIP_BUFFERED in c->buffered was moved from ngx_http_gzip_filter_deflate_start() to ngx_http_gzip_filter_buffer() since it was always called first. But in r2543 the "postpone_gzipping" directive was introduced, and if postponed gzipping is disabled (the default setting), ngx_http_gzip_filter_buffer() is not called at all. We must always set NGX_HTTP_GZIP_BUFFERED after the start of compression since there is always a trailer that is buffered. There are no known cases when it leads to any problem with current code. But we already had troubles in upcoming SPDY implementation.
2013-03-07SSL: Next Protocol Negotiation extension support.Valentin Bartenev1-0/+34
Not only this is useful for the upcoming SPDY support, but it can also help to improve HTTPS performance by enabling TLS False Start in Chrome/Chromium browsers [1]. So, we always enable NPN for HTTPS if it is supported by OpenSSL. [1] http://www.imperialviolet.org/2012/04/11/falsestart.html
2013-03-07Refactored ngx_http_init_request().Valentin Bartenev2-35/+46
Now it can be used as the request object factory with minimal impact on the connection object. Therefore it was renamed to ngx_http_create_request().
2013-03-07Removed c->single_connection flag.Valentin Bartenev4-9/+3
The c->single_connection was intended to be used as lock mechanism to serialize modifications of request object from several threads working with client and upstream connections. The flag is redundant since threads in nginx have never been used that way.
2013-03-07Respect the new behavior of TCP_DEFER_ACCEPT.Valentin Bartenev1-0/+23
In Linux 2.6.32, TCP_DEFER_ACCEPT was changed to accept connections after the deferring period is finished without any data available. (Reading from the socket returns EAGAIN in this case.) Since in nginx TCP_DEFER_ACCEPT is set to "post_accept_timeout", we do not need to wait longer if deferred accept returns with no data.
2013-03-07Use "client_header_timeout" for all requests in a connection.Valentin Bartenev1-2/+8
Previously, only the first request in a connection used timeout value from the "client_header_timeout" directive while reading header. All subsequent requests used "keepalive_timeout" for that. It happened because timeout of the read event was set to the value of "keepalive_timeout" in ngx_http_set_keepalive(), but was not removed when the next request arrived.
2013-03-07Create request object only after the first byte was received.Valentin Bartenev1-25/+102
Previously, we always created an object and logged 400 (Bad Request) in access log if a client closed connection without sending any data. Such a connection was counted as "reading". Since it's common for modern browsers to behave like this, it's no longer considered an error if a client closes connection without sending any data, and such a connection will be counted as "waiting". Now, we do not log 400 (Bad Request) and keep memory footprint as small as possible.
2013-03-07Version bump.Valentin Bartenev2-3/+3
2013-03-04Mp4: fixed handling of too small mdat atoms (ticket #266).Maxim Dounin1-0/+7
Patch by Gernot Vormayr (with minor changes).
2013-03-01Allocate request object from its own pool.Valentin Bartenev2-40/+32
Previously, it was allocated from a connection pool and was selectively freed for an idle keepalive connection. The goal is to put coupled things in one chunk of memory, and to simplify handling of request objects.
2013-02-27SNI: added restriction on requesting host other than negotiated.Valentin Bartenev1-0/+12
According to RFC 6066, client is not supposed to request a different server name at the application layer. Server implementations that rely upon these names being equal must validate that a client did not send a different name in HTTP request. Current versions of Apache HTTP server always return 400 "Bad Request" in such cases. There exist implementations however (e.g., SPDY) that rely on being able to request different host names in one connection. Given this, we only reject requests with differing host names if verification of client certificates is enabled in a corresponding server configuration. An example of configuration that might not work as expected: server { listen 433 ssl default; return 404; } server { listen 433 ssl; server_name example.org; ssl_client_certificate org.cert; ssl_verify_client on; } server { listen 433 ssl; server_name example.com; ssl_client_certificate com.cert; ssl_verify_client on; } Previously, a client was able to request example.com by presenting a certificate for example.org, and vice versa.
2013-02-27SNI: reset to default server if requested host was not found.Valentin Bartenev1-0/+11
Not only this is consistent with a case without SNI, but this also prevents abusing configurations that assume that the $host variable is limited to one of the configured names for a server. An example of potentially unsafe configuration: server { listen 443 ssl default_server; ... } server { listen 443; server_name example.com; location / { proxy_pass http://$host; } } Note: it is possible to negotiate "example.com" by SNI, and to request arbitrary host name that does not exist in the configuration above.
2013-02-27SNI: avoid surplus lookup of virtual server if SNI was used.Valentin Bartenev2-0/+41
2013-02-27Apply server configuration as soon as host is known.Valentin Bartenev1-4/+18
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.
2013-02-27SSL: do not treat SSL handshake as request.Valentin Bartenev2-90/+100
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.
2013-02-27Status: do not count connection as reading right after accept().Valentin Bartenev1-19/+0
Before we receive the first bytes, the connection is counted as waiting. This change simplifies further code changes.
2013-02-27SNI: reuse selected configuration for all requests in a connection.Valentin Bartenev3-7/+12
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.
2013-02-27SNI: ignore captures in server_name regexes when matching by SNI.Valentin Bartenev1-43/+103
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.
2013-02-27Changed interface of ngx_http_validate_host().Valentin Bartenev1-42/+44
2013-02-27Introduced the ngx_http_set_connection_log() macro.Valentin Bartenev3-13/+12
No functional changes.
2013-02-27The default server lookup is now done only once per connection.Valentin Bartenev3-126/+126
Previously, it was done for every request in a connection.
2013-02-27Correctly handle multiple X-Forwarded-For headers (ticket #106).Ruslan Ermilov9-67/+139
2013-02-27Fixed separator in $sent_http_cache_control.Ruslan Ermilov1-6/+27
In case multiple "Cache-Control" headers are sent to a client, multiple values in $sent_http_cache_control were incorrectly split by a semicolon. Now they are split by a comma.