summaryrefslogtreecommitdiffhomepage
path: root/src/http (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-11-05SSL: only select SPDY using NPN if "spdy" is enabled.Valentin Bartenev1-8/+16
OpenSSL doesn't check if the negotiated protocol has been announced. As a result, the client might force using SPDY even if it wasn't enabled in configuration.
2015-09-03Upstream: fixed cache send error handling.Roman Arutyunyan1-11/+14
The value of NGX_ERROR, returned from filter handlers, was treated as a generic upstream error and changed to NGX_HTTP_INTERNAL_SERVER_ERROR before calling ngx_http_finalize_request(). This resulted in "header already sent" alert if header was already sent in filter handlers. The problem appeared in 54e9b83d00f0 (1.7.5).
2015-08-16Fixed wrong URI after try_files in nested location (ticket #97).Maxim Dounin1-3/+5
The following configuration with alias, nested location and try_files resulted in wrong file being used. Request "/foo/test.gif" tried to use "/tmp//foo/test.gif" instead of "/tmp/test.gif": location /foo/ { alias /tmp/; location ~ gif { try_files $uri =405; } } Additionally, rev. c985d90a8d1f introduced a regression if the "/tmp//foo/test.gif" file was found (ticket #768). Resulting URI was set to "gif?/foo/test.gif", as the code used clcf->name of current location ("location ~ gif") instead of parent one ("location /foo/"). Fix is to use r->uri instead of clcf->name in all cases in the ngx_http_core_try_files_phase() function. It is expected to be already matched and identical to the clcf->name of the right location.
2015-08-16Fixed segfault with try_files introduced by c985d90a8d1f.Maxim Dounin1-1/+3
If alias was used in a location given by a regular expression, nginx used to do wrong thing in try_files if a location name (i.e., regular expression) was an exact prefix of URI. The following configuration triggered a segmentation fault on a request to "/mail": location ~ /mail { alias /path/to/directory; try_files $uri =404; } Reported by Per Hansson.
2015-04-24Merge proxy_protocol setting of listen directives.Roman Arutyunyan1-1/+4
It's now enough to specify proxy_protocol option in one listen directive to enable it in all servers listening on the same address/port. Previously, the setting from the first directive was always used.
2015-04-07Upstream: abbreviated SSL handshake may interact badly with Nagle.Ruslan Ermilov1-1/+25
2015-04-06Request body: always flush buffers if request buffering is off.Valentin Bartenev1-0/+2
This fixes unbuffered proxying to SSL backends, since it prevents ngx_ssl_send_chain() from accumulation of request body in the SSL buffer.
2015-04-01Cache: added support for reading of the header in thread pools.Valentin Bartenev2-19/+109
2015-03-31Fixed invalid access to complex value defined as an empty string.Sergey Kandaurov2-5/+5
Found by Valgrind.
2015-03-23SPDY: always push pending data.Valentin Bartenev1-51/+40
This helps to avoid suboptimal behavior when a client waits for a control frame or more data to increase window size, but the frames have been delayed in the socket buffer. The delays can be caused by bad interaction between Nagle's algorithm on nginx side and delayed ACK on the client side or by TCP_CORK/TCP_NOPUSH if SPDY was working without SSL and sendfile() was used. The pushing code is now very similar to ngx_http_set_keepalive().
2015-03-23SPDY: fixed error handling in ngx_http_spdy_send_output_queue().Valentin Bartenev1-8/+12
2015-03-26Proxy: fixed proxy_request_buffering and chunked with preread body.Maxim Dounin1-3/+4
If any preread body bytes were sent in the first chain, chunk size was incorrectly added before the whole chain, including header, resulting in an invalid request sent to upstream. Fixed to properly add chunk size after the header.
2015-03-23Upstream: uwsgi_request_buffering, scgi_request_buffering.Maxim Dounin2-2/+44
2015-03-23FastCGI: fastcgi_request_buffering.Maxim Dounin1-18/+342
2015-03-23Proxy: proxy_request_buffering chunked support.Maxim Dounin1-6/+216
2015-03-23Request body: unbuffered reading.Maxim Dounin8-25/+306
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-23Request body: filters support.Maxim Dounin5-8/+22
2015-03-23Request body: moved request body writing to save filter.Maxim Dounin1-14/+8
2015-03-23Request body: free chain links in ngx_http_write_request_body().Maxim Dounin1-2/+7
2015-03-23Format specifier fixed for file size of buffers.Maxim Dounin2-5/+5
2015-03-23Proxy: fixed proxy_set_body with proxy_cache.Maxim Dounin1-0/+1
If the last header evaluation resulted in an empty header, the e.skip flag was set and was not reset when we've switched to evaluation of body_values. This incorrectly resulted in body values being skipped instead of producing some correct body as set by proxy_set_body. Fix is to properly reset the e.skip flag. As the problem only appeared if the last potentially non-empty header happened to be empty, it only manifested itself if proxy_set_body was used with proxy_cache.
2015-03-23Removed stub implementation of win32 mutexes.Ruslan Ermilov1-2/+0
2015-03-23SSL: avoid SSL_CTX_set_tmp_rsa_callback() call with LibreSSL.Maxim Dounin1-0/+2
LibreSSL removed support for export ciphers and a call to SSL_CTX_set_tmp_rsa_callback() results in an error left in the error queue. This caused alerts "ignoring stale global SSL error (...called a function you should not call) while SSL handshaking" on a first connection in each worker process.
2015-03-20Removed busy locks.Ruslan Ermilov3-362/+0
2015-03-20Removed ngx_connection_t.lock.Ruslan Ermilov1-3/+0
2015-03-15SPDY: fixed format specifier in logging.Xiaochen Wang1-1/+1
2015-03-14Added support for offloading read() in thread pools.Valentin Bartenev4-3/+159
2015-03-04Renamed NGX_THREADS to NGX_OLD_THREADS because of deprecation.Ruslan Ermilov1-1/+1
It's mostly dead code and the original idea of worker threads has been rejected.
2015-03-17Overflow detection in ngx_http_parse_chunked().Ruslan Ermilov1-4/+8
2015-03-17Overflow detection in ngx_http_range_parse().Ruslan Ermilov1-1/+12
2015-03-13The "aio" directive parser made smarter.Ruslan Ermilov2-27/+52
It now prints meaningful warnings on all platforms. No functional changes.
2015-03-12Deprecated "aio sendfile".Ruslan Ermilov3-9/+4
Specifying "sendfile on" along with "aio on" activates the aio pre-loading mode for sendfile().
2015-03-04Proxy: use an appropriate error on memory allocation failure.Ruslan Ermilov1-1/+1
2015-03-04Style: moved ngx_http_ephemeral() macro to ngx_http_request.h.Ruslan Ermilov2-3/+3
2015-03-03Upstream keepalive: drop ready flag on EAGAIN from recv(MSG_PEEK).Valentin Bartenev1-1/+1
Keeping the ready flag in this case might results in missing notification of broken connection until nginx tried to use it again. While there, stale comment about stale event was removed since this function is also can be called directly.
2015-03-03Style.Maxim Dounin1-2/+2
Noted by Ruslan Ermilov.
2015-03-02Upstream: upstream argument in ngx_http_upstream_process_request().Maxim Dounin1-6/+6
In case of filter finalization, r->upstream might be changed during the ngx_event_pipe() call. Added an argument to preserve it while calling the ngx_http_upstream_process_request() function.
2015-03-02Upstream: avoid duplicate finalization.Maxim Dounin1-3/+7
A request may be already finalized when ngx_http_upstream_finalize_request() is called, due to filter finalization: after filter finalization upstream can be finalized via ngx_http_upstream_cleanup(), either from ngx_http_terminate_request(), or because a new request was initiated to an upstream. Then the upstream code will see an error returned from the filter chain and will call the ngx_http_upstream_finalize_request() function again. To prevent corruption of various upstream data in this situation, make sure to do nothing but merely call ngx_http_finalize_request(). Prodded by Yichun Zhang, for details see the thread at http://nginx.org/pipermail/nginx-devel/2015-February/006539.html.
2015-03-02SSL: reset ready flag if recv(MSG_PEEK) found no bytes in socket.Roman Arutyunyan1-0/+1
Previously, connection hung after calling ngx_http_ssl_handshake() with rev->ready set and no bytes in socket to read. It's possible in at least the following cases: - when processing a connection with expired TCP_DEFER_ACCEPT on Linux - after parsing PROXY protocol header if it arrived in a separate TCP packet Thanks to James Hamlin.
2015-03-02Cache: do not inherit last_modified and etag from stale response.Roman Arutyunyan2-2/+7
When replacing a stale cache entry, its last_modified and etag could be inherited from the old entry if the response code is not 200 or 206. Moreover, etag could be inherited with any response code if it's missing in the new response. As a result, the cache entry is left with invalid last_modified or etag which could lead to broken revalidation. For example, when a file is deleted from backend, its last_modified is copied to the new 404 cache entry and is used later for revalidation. Once the old file appears again with its original timestamp, revalidation succeeds and the cached 404 response is sent to client instead of the file. The problem appeared with etags in 44b9ab7752e3 (1.7.3) and affected last_modified in 1573fc7875fa (1.7.9).
2015-03-02Upstream hash: speedup consistent hash init.Roman Arutyunyan1-21/+31
Repeatedly calling ngx_http_upstream_add_chash_point() to create the points array in sorted order, is O(n^2) to the total weight. This can cause nginx startup and reconfigure to be substantially delayed. For example, when total weight is 1000, startup takes 5s on a modern laptop. Replace this with a linear insertion followed by QuickSort and duplicates removal. Startup for total weight of 1000 reduces to 40ms. Based on a patch by Wai Keen Woon.
2015-02-17Cache: reduced diffs to the plus version of nginx.Ruslan Ermilov1-6/+4
No functional changes.
2015-02-11Refactored sendfile() AIO preload.Valentin Bartenev2-66/+36
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.
2015-01-22Upstream: detect port absence in fastcgi_pass with IP literal.Ruslan Ermilov1-1/+1
If fastcgi_pass (or any look-alike that doesn't imply a default port) is specified as an IP literal (as opposed to a hostname), port absence was not detected at configuration time and could result in EADDRNOTAVAIL at run time. Fixed this in such a way that configs like http { server { location / { fastcgi_pass 127.0.0.1; } } upstream 127.0.0.1 { server 10.0.0.1:12345; } } still work. That is, port absence check is delayed until after we make sure there's no explicit upstream with such a name.
2015-01-21Fixed try_files directory test to match only a directory.Damien Tournoud1-1/+1
Historically, it was possible to match either a file or directory in the following configuration: location / { try_files $uri/ =404; }
2015-02-02Cache: added temp_path to file cache.Roman Arutyunyan3-21/+51
If use_temp_path is set to off, a subdirectory "temp" is created in the cache directory. It's used instead of proxy_temp_path and friends for caching upstream response.
2015-01-14Upstream: $upstream_header_time variable.Vladimir Homutov2-2/+24
Keeps time spent on obtaining the header from an upstream server. The value is formatted similar to the $upstream_response_time variable.
2014-12-26Upstream: use_temp_path parameter of proxy_cache_path and friends.Valentin Bartenev3-1/+46
When set to "off", temporary files for cacheable responses will be stored inside cache directory.
2014-12-26Cache: update variant while setting header.Valentin Bartenev3-37/+62
Some parts of code related to handling variants of a resource moved into a separate function that is called earlier. This allows to use cache file name as a prefix for temporary file in the following patch.
2014-12-22Upstream: added variables support to proxy_cache and friends.Valentin Bartenev7-36/+352