summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_request.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-07-19Upstream: keep request body file from removal if requested.Roman Arutyunyan1-0/+1
The new request flag "preserve_body" indicates that the request body file should not be removed by the upstream module because it may be used later by a subrequest. The flag is set by the SSI (ticket #585), addition and slice modules. Additionally, it is also set by the upstream module when a background cache update subrequest is started to prevent the request body file removal after an internal redirect. Only the main request is now allowed to remove the file.
2017-03-24Added support for trailers in HTTP responses.Piotr Sikora1-0/+2
Example: ngx_table_elt_t *h; h = ngx_list_push(&r->headers_out.trailers); if (h == NULL) { return NGX_ERROR; } ngx_str_set(&h->key, "Fun"); ngx_str_set(&h->value, "with trailers"); h->hash = ngx_hash_key_lc(h->key.data, h->key.len); The code above adds "Fun: with trailers" trailer to the response. Modules that want to emit trailers must set r->expect_trailers = 1 in header filter, otherwise they might not be emitted for HTTP/1.1 responses that aren't already chunked. This change also adds $sent_trailer_* variables. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2017-05-25Background subrequests for cache updates.Roman Arutyunyan1-1/+2
Previously, cache background update might not work as expected, making client wait for it to complete before receiving the final part of a stale response. This could happen if the response could not be sent to the client socket in one filter chain call. Now background cache update is done in a background subrequest. This type of subrequest does not block any other subrequests or the main request.
2017-04-25Don't pretend we support HTTP major versions >1 as HTTP/1.1.Ruslan Ermilov1-2/+4
2017-04-11Added support for the "308 Permanent Redirect" (ticket #877).Simon Leblanc1-0/+1
2017-03-24Added support for "429 Too Many Requests" response (RFC6585).Piotr Sikora1-0/+1
This change adds reason phrase in status line and pretty response body when "429" status code is used in "return", "limit_conn_status" and/or "limit_req_status" directives. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2017-03-07Converted hc->busy/hc->free to use chain links.Maxim Dounin1-3/+2
Most notably, this fixes possible buffer overflows if number of large client header buffers in a virtual server is different from the one in the default server. Reported by Daniil Bondarev.
2017-02-10Upstream: proxy_cache_background_update and friends.Roman Arutyunyan1-1/+4
The directives enable cache updates in subrequests.
2016-10-10Modules compatibility: compatibility with NGX_HTTP_SSL.Maxim Dounin1-3/+1
With this change it is now possible to load modules compiled without the "--with-http_ssl_module" configure option into nginx binary compiled with it, and vice versa (if a module doesn't use ssl-specific functions), assuming both use the "--with-compat" option.
2016-10-03Modules compatibility: http2.Maxim Dounin1-4/+0
HTTP/2-specific fields in structures are now available unconditionally. Removed NGX_HTTP_V2 from the signature accordingly.
2016-09-29Modules compatibility: status fields.Maxim Dounin1-0/+1
2016-09-29Modules compatibility: health check fields.Maxim Dounin1-0/+2
2016-09-20Removed influence of some options on structures.Ruslan Ermilov1-4/+1
2016-05-20HTTP/2: the "421 Misdirected Request" response (closes #848).Valentin Bartenev1-0/+1
Since 4fbef397c753 nginx rejects with the 400 error any attempts of requesting different host over the same connection, if the relevant virtual server requires verification of a client certificate. While requesting hosts other than negotiated isn't something legal in HTTP/1.x, the HTTP/2 specification explicitly permits such requests for connection reuse and has introduced a special response code 421. According to RFC 7540 Section 9.1.2 this code can be sent by a server that is not configured to produce responses for the combination of scheme and authority that are included in the request URI. And the client may retry the request over a different connection. Now this code is used for requests that aren't authorized in current connection. After receiving the 421 response a client will be able to open a new connection, provide the required certificate and retry the request. Unfortunately, not all clients currently are able to handle it well. Notably Chrome just shows an error, while at least the latest version of Firefox retries the request over a new connection.
2016-05-16Dav: return 501 on PUT with ranges (ticket #948).Maxim Dounin1-0/+1
2016-04-01HTTP/2: rewritten handling of request body.Valentin Bartenev1-0/+3
There are two improvements: 1. Support for request body filters; 2. Receiving of request body is started only after the ngx_http_read_client_request_body() call. The last one fixes the problem when the client_max_body_size value might not be respected from the right location if the location was changed either during the process of receiving body or after the whole body had been received.
2015-12-07Slice filter.Roman Arutyunyan1-0/+2
Splits a request into subrequests, each providing a specific range of response. The variable "$slice_range" must be used to set subrequest range and proper cache key. The directive "slice" sets slice size. The following example splits requests into 1-megabyte cacheable subrequests. server { listen 8000; location / { slice 1m; proxy_cache cache; proxy_cache_key $uri$is_args$args$slice_range; proxy_set_header Range $slice_range; proxy_cache_valid 200 206 1h; proxy_pass http://127.0.0.1:9000; } }
2015-09-11The HTTP/2 implementation (RFC 7240, 7241).Valentin Bartenev1-2/+3
The SPDY support is removed, as it's incompatible with the new module.
2015-08-31Decreased the NGX_HTTP_MAX_SUBREQUESTS limit.Valentin Bartenev1-1/+1
There is no much sense in such a big value since its semantics has been changed in 06e850859a26 to limit recursive subrequests.
2015-08-31Added protection against r->main->count overflow by subrequests.Valentin Bartenev1-1/+1
This overflow has become possible after the change in 06e850859a26, since concurrent subrequests are not limited now and each of them is counted in r->main->count.
2015-04-25Core: the ngx_set_connection_log() macro.Vladimir Homutov1-11/+0
The http and stream versions of this macro were identical.
2015-03-23Request body: unbuffered reading.Maxim Dounin1-0/+2
The r->request_body_no_buffering flag was introduced. It instructs client request body reading code to avoid reading the whole body, and to call post_handler early instead. The caller should use the ngx_http_read_unbuffered_request_body() function to read remaining parts of the body. Upstream module is now able to use this mode, if configured with the proxy_request_buffering directive.
2015-03-04Style: moved ngx_http_ephemeral() macro to ngx_http_request.h.Ruslan Ermilov1-0/+3
2015-02-11Refactored sendfile() AIO preload.Valentin Bartenev1-3/+0
This reduces layering violation and simplifies the logic of AIO preread, since it's now triggered by the send chain function itself without falling back to the copy filter. The context of AIO operation is now stored per file buffer, which makes it possible to properly handle cases when multiple buffers come from different locations, each with its own configuration.
2014-12-02Upstream: improved subrequest logging.Maxim Dounin1-0/+4
To ensure proper logging make sure to set current_request in all event handlers, including resolve, ssl handshake, cache lock wait timer and aio read handlers. A macro ngx_http_set_log_request() introduced to simplify this.
2014-06-26Entity tags: explicit flag to skip not modified filter.Maxim Dounin1-0/+1
Previously, last_modified_time was tested against -1 to check if the not modified filter should be skipped. Notably, this prevented nginx from additional If-Modified-Since (et al.) checks on proxied responses. Such behaviour is suboptimal in some cases though, as checks are always skipped on responses from a cache with ETag only (without Last-Modified), resulting in If-None-Match being ignored in such cases. Additionally, it was not possible to return 412 from the If-Unmodified-Since if last modification time was not known for some reason. This change introduces explicit r->disable_not_modified flag instead, which is set by ngx_http_upstream_process_headers().
2014-05-12Added syslog support for error_log and access_log directives.Vladimir Homutov1-0/+2
2014-05-19Charset filter: fixed charset setting on encoded replies.Maxim Dounin1-1/+0
If response is gzipped we can't recode response, but in case it's not needed we still can add charset to Content-Type. The r->ignore_content_encoding is dropped accordingly, charset with gzip_static now properly works without any special flags.
2014-03-21Range filter: single_range flag in request.Maxim Dounin1-0/+1
If set, it means that response body is going to be in more than one buffer, hence only range requests with a single range should be honored. The flag is now used by mp4 and cacheable upstream responses, thus allowing range requests of mp4 files with start/end, as well as range processing on a first request to a not-yet-cached files with proxy_cache. Notably this makes it possible to play mp4 files (with proxy_cache, or with mp4 module) on iOS devices, as byte-range support is required by Apple.
2014-03-17Added server-side support for PROXY protocol v1 (ticket #355).Roman Arutyunyan1-1/+2
Client address specified in the PROXY protocol header is now saved in the $proxy_protocol_addr variable and can be used in the realip module. This is currently not implemented for mail.
2013-06-20Core: support several "error_log" directives.Vladimir Homutov1-0/+1
When several "error_log" directives are specified in the same configuration block, logs are written to all files with a matching log level. All logs are stored in the singly-linked list that is sorted by log level in the descending order. Specific debug levels (NGX_LOG_DEBUG_HTTP,EVENT, etc.) are not supported if several "error_log" directives are specified. In this case all logs will use debug level that has largest absolute value.
2013-05-11Added r->limit_rate_after.Maxim Dounin1-0/+1
As of now, it allows to better control bandwidth limiting from additional modules. It is also expected to be used to add variables support to the limit_rate_after directive.
2013-05-11Fixed build with --with-mail_ssl_module.Maxim Dounin1-1/+1
If nginx was compiled without --with-http_ssl_module, but with some other module which uses OpenSSL (e.g. --with-mail_ssl_module), insufficient preprocessor check resulted in build failure. The problem was introduced by e0a3714a36f8 (1.3.14). Reported by Roman Arutyunyan.
2013-03-20Preliminary experimental support for SPDY draft 2.Valentin Bartenev1-0/+3
2013-03-07Refactored ngx_http_init_request().Valentin Bartenev1-2/+3
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-01Allocate request object from its own pool.Valentin Bartenev1-2/+0
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: avoid surplus lookup of virtual server if SNI was used.Valentin Bartenev1-0/+7
2013-02-27SSL: do not treat SSL handshake as request.Valentin Bartenev1-2/+2
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-27SNI: reuse selected configuration for all requests in a connection.Valentin Bartenev1-0/+1
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-27Introduced the ngx_http_set_connection_log() macro.Valentin Bartenev1-0/+8
No functional changes.
2013-02-27The default server lookup is now done only once per connection.Valentin Bartenev1-13/+4
Previously, it was done for every request in a connection.
2013-02-27Correctly handle multiple X-Forwarded-For headers (ticket #106).Ruslan Ermilov1-1/+1
2013-02-18Proxy: support for connection upgrade (101 Switching Protocols).Maxim Dounin1-0/+5
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.
2012-11-21Request body: chunked transfer encoding support.Maxim Dounin1-1/+4
2012-07-07Entity tags: basic support in not modified filter.Maxim Dounin1-0/+2
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).
2012-06-21Fixed compile-time conditionals used to detect if X-Forwarded-For supportRuslan Ermilov1-1/+1
is needed.
2012-02-28Raised simultaneous subrequest limit from 50 to 200.Maxim Dounin1-1/+1
It wasn't enforced for a long time, and there are reports that people use up to 100 simultaneous subrequests now. As this is a safety limit to prevent loops, it's raised accordingly.
2012-02-27Added support for the 307 Temporary Redirect.Ruslan Ermilov1-0/+1
2012-02-10Fixed module name in comment. It was forgotten in r4281.Valentin Bartenev1-1/+1
2012-01-18Copyright updated.Maxim Konovalov1-0/+1