summaryrefslogtreecommitdiffhomepage
path: root/src/os/unix/ngx_darwin_sendfile_chain.c (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2017-01-20Fixed trailer construction with limit on FreeBSD and macOS.Maxim Dounin1-1/+1
The ngx_chain_coalesce_file() function may produce more bytes to send then requested in the limit passed, as it aligns the last file position to send to memory page boundary. As a result, (limit - send) may become negative. This resulted in big positive number when converted to size_t while calling ngx_output_chain_to_iovec(). Another part of the problem is in ngx_chain_coalesce_file(): it changes cl to the next chain link even if the current buffer is only partially sent due to limit. Therefore, if a file buffer was not expected to be fully sent due to limit, and was followed by a memory buffer, nginx called sendfile() with a part of the file buffer, and the memory buffer in trailer. If there were enough room in the socket buffer, this resulted in a part of the file buffer being skipped, and corresponding part of the memory buffer sent instead. The bug was introduced in 8e903522c17a (1.7.8). Configurations affected are ones using limits, that is, limit_rate and/or sendfile_max_chunk, and memory buffers after file ones (may happen when using subrequests or with proxying with disk buffering). Fix is to explicitly check if (send < limit) before constructing trailer with ngx_output_chain_to_iovec(). Additionally, ngx_chain_coalesce_file() was modified to preserve unfinished file buffers in cl.
2015-01-13Fixed sendfile() trailers on OS X (8e903522c17a, 1.7.8).Maxim Dounin1-0/+3
The trailer.count variable was not initialized if there was a header, resulting in "sendfile() failed (22: Invalid argument)" alerts on OS X if the "sendfile" directive was used. The bug was introduced in 8e903522c17a (1.7.8).
2014-11-19Style.Valentin Bartenev1-2/+2
2014-08-13Moved writev() handling code to a separate function.Valentin Bartenev1-24/+5
This reduces code duplication and unifies debug logging of the writev() syscall among various send chain functions.
2014-08-13Merged conditions in the ngx_*_sendfile_chain() functions.Valentin Bartenev1-13/+10
No functional changes.
2014-08-13Moved the code for coalescing file buffers to a separate function.Valentin Bartenev1-24/+3
2014-10-07Introduced the ngx_output_chain_to_iovec() function.Valentin Bartenev1-102/+24
It deduplicates code of the send chain functions and uses only preallocated memory, which completely solves the problem mentioned in d1bde5c3c5d2.
2014-11-19Renamed ngx_handle_sent_chain() to ngx_chain_update_sent().Valentin Bartenev1-1/+1
No functional changes.
2014-08-27Fixed counting of sent bytes in the send chain functions on EINTR.Valentin Bartenev1-0/+1
Previously, a value of the "send" variable wasn't properly adjusted in a rare case when syscall was interrupted by a signal. As a result, these functions could send less data than the limit allows.
2014-08-13Generalized definitions of the number of preallocated iovec's.Valentin Bartenev1-12/+5
No functional changes.
2014-08-13Removed the "complete" variable from various send chain functions.Valentin Bartenev1-7/+2
It was made redundant by the previous change, since the "sent" variable is no longer modified.
2014-08-13Moved the code for adjusting sent buffers in a separate function.Valentin Bartenev1-36/+1
2014-08-13Fixed writev() debug log message in ngx_darwin_sendfile_chain().Valentin Bartenev1-1/+1
2014-06-19FreeBSD has migrated to Bugzilla.Sergey Kandaurov1-1/+1
2013-08-08Don't lose pointer to first nonempty buf in ngx_*_sendfile_chain().Gleb Smirnoff1-16/+14
In ngx_*_sendfile_chain() when calculating pointer to a first non-zero sized buf, use "in" as iterator. This fixes processing of zero sized buf(s) after EINTR. Otherwise function can return zero sized buf to caller, and later ngx_http_write_filter() logs warning.
2012-04-17IOV_MAX handling microoptimization.Maxim Dounin1-5/+11
We now stop on IOV_MAX iovec entries only if we are going to add new one, i.e. next buffer can't be coalesced into last iovec. This also fixes incorrect checks for trailer creation on FreeBSD and Mac OS X, header.nelts was checked instead of trailer.nelts.
2012-02-28Fixed spelling in single-line comments.Ruslan Ermilov1-1/+1
2012-01-18Copyright updated.Maxim Konovalov1-0/+1
2009-08-30refactor EAGAIN/EINTR processingIgor Sysoev1-19/+21
2008-07-30*) move Darwin support to separate filesIgor Sysoev1-78/+31
*) Darwin sendfile() support
2007-07-29make 64-bit ngx_int_t on 64-bit platformsIgor Sysoev1-1/+1
2007-04-23fix sendfile on 64-bit Linux and limit_rate on all 64-bit platformsIgor Sysoev1-1/+1
for 2G+ files
2006-01-11nginx-0.3.20-RELEASE importrelease-0.3.20Igor Sysoev1-2/+7
*) Bugfix: in SSI handling. *) Bugfix: the ngx_http_memcached_module did not support the keys in the "/usr?args" form.
2005-12-07nginx-0.3.15-RELEASE importrelease-0.3.15Igor Sysoev1-5/+1
*) Feature: the new 444 code of the "return" directive to close connection. *) Feature: the "so_keepalive" directive in IMAP/POP3 proxy. *) Bugfix: if there are unclosed connection nginx now calls abort() only on gracefull quit and active "debug_points" directive.
2005-11-26nginx-0.3.12-RELEASE importrelease-0.3.12Igor Sysoev1-1/+1
*) Security: if nginx was built with the ngx_http_realip_module and the "satisfy_any on" directive was used, then access and authorization directives did not work. The ngx_http_realip_module was not built and is not built by default. *) Change: the "$time_gmt" variable name was changed to "$time_local". *) Change: the "proxy_header_buffer_size" and "fastcgi_header_buffer_size" directives was renamed to the "proxy_buffer_size" and "fastcgi_buffer_size" directives. *) Feature: the ngx_http_memcached_module. *) Feature: the "proxy_buffering" directive. *) Bugfix: the changes in accept mutex handling when the "rtsig" method was used; the bug had appeared in 0.3.0. *) Bugfix: if the client sent the "Transfer-Encoding: chunked" header line, then nginx returns the 411 error. *) Bugfix: if the "auth_basic" directive was inherited from the http level, then the realm in the "WWW-Authenticate" header line was without the "Basic realm" text. *) Bugfix: if the "combined" format was explicitly specified in the "access_log" directive, then the empty lines was written to the log; the bug had appeared in 0.3.8. *) Bugfix: nginx did not run on the sparc platform under any OS except Solaris. *) Bugfix: now it is not necessary to place space between the quoted string and closing bracket in the "if" directive.
2005-09-06nginx-0.1.44-RELEASE importrelease-0.1.44Igor Sysoev1-1/+5
*) Feature: the IMAP/POP3 proxy supports SSL. *) Feature: the "proxy_timeout" directive of the ngx_imap_proxy_module. *) Feature: the "userid_mark" directive. *) Feature: the $remote_user variable value is determined independently of authorization use.
2005-08-30nginx-0.1.43-RELEASE importrelease-0.1.43Igor Sysoev1-6/+5
*) Feature: the listen(2) backlog in the "listen" directive can be changed using the -HUP signal. *) Feature: the geo2nginx.pl script was added to contrib. *) Change: the FastCGI parameters with the empty values now are passed to a server. *) Bugfix: the segmentation fault occurred or the worker process may got caught in an endless loop if the proxied or FastCGI server sent the "Cache-Control" header line and the "expires" directive was used; in the proxied mode the the bug had appeared in 0.1.29.
2005-03-19nginx-0.1.25-RELEASE importrelease-0.1.25Igor Sysoev1-8/+10
*) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
2005-01-25nginx-0.1.16-RELEASE importrelease-0.1.16Igor Sysoev1-3/+9
*) Bugfix: if the response were transferred by chunks, then on the HEAD request the final chunk was issued. *) Bugfix: the "Connection: keep-alive" header were issued, even if the keepalive_timeout directive forbade the keep-alive use. *) Bugfix: the errors in the ngx_http_fastcgi_module caused the segmentation faults. *) Bugfix: the compressed response encrypted by SSL may not transferred complete. *) Bugfix: the TCP-specific TCP_NODELAY, TCP_NOPSUH, and TCP_CORK options, are not used for the unix domain sockets. *) Feature: the rewrite directive supports the arguments rewriting. *) Bugfix: the response code 400 was returned for the POST request with the "Content-Length: 0" header; the bug had appeared in 0.1.14.
2005-01-18nginx-0.1.14-RELEASE importrelease-0.1.14Igor Sysoev1-10/+10
*) Feature: the autoconfiguration directives: --http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and --http-fastcgi-temp-path=PATH *) Change: the directory name for the temporary files with the client request body is specified by directive client_body_temp_path, by default it is <prefix>/client_body_temp. *) Feature: the ngx_http_fastcgi_module and the directives: fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params, fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout, fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers, fastcgi_busy_buffers_size, fastcgi_temp_path, fastcgi_max_temp_file_size, fastcgi_temp_file_write_size, fastcgi_next_upstream, and fastcgi_x_powered_by. *) Bugfix: the "[alert] zero size buf" error; the bug had appeared in 0.1.3. *) Change: the URI must be specified after the host name in the proxy_pass directive. *) Change: the %3F symbol in the URI was considered as the argument string start. *) Feature: the unix domain sockets support in the ngx_http_proxy_module. *) Feature: the ssl_engine and ssl_ciphers directives. Thanks to Sergey Skvortsov for SSL-accelerator.
2004-12-21nginx-0.1.13-RELEASE importrelease-0.1.13Igor Sysoev1-2/+2
*) Feature: the server_names_hash and server_names_hash_threshold directives. *) Bugfix: the *.domain.tld names in the "server_name" directive did not work. *) Bugfix: the %request_length log parameter logged the incorrect length.
2004-12-02nginx-0.1.11-RELEASE importrelease-0.1.11Igor Sysoev1-23/+27
*) Feature: the worker_priority directive. *) Change: both tcp_nopush and tcp_nodelay directives affect the transferred response. *) Bugfix: nginx did not call initgroups(). Thanks to Andrew Sitnikov and Andrei Nigmatulin. *) Change: now the ngx_http_autoindex_module shows the file size in the bytes. *) Bugfix: the ngx_http_autoindex_module returned the 500 error if the broken symlink was in a directory. *) Bugfix: the files bigger than 4G could not be transferred using sendfile. *) Bugfix: if the backend was resolved to several backends and there was an error while the response waiting then process may got caught in an endless loop. *) Bugfix: the worker process may exit with the "unknown cycle" message when the /dev/poll method was used. *) Bugfix: "close() channel failed" errors. *) Bugfix: the autodetection of the "nobody" and "nogroup" groups. *) Bugfix: the send_lowat directive did not work on Linux. *) Bugfix: the segmentation fault occurred if there was no events section in configuration. *) Bugfix: nginx could not be built on OpenBSD. *) Bugfix: the double slashes in "://" in the URI were converted to ":/".
2004-11-25nginx-0.1.9-RELEASE importrelease-0.1.9Igor Sysoev1-1/+1
*) Bugfix: the proxied request was sent without arguments if the request contains "//", "/./", "/../" or "%XX". *) Bugfix: the large compressed responses may be transferred not completely. *) Bugfix: the files bigger than 2G was not transferred on Linux that does not support sendfile64(). *) Bugfix: while the build configuration on Linux the --with-poll_module parameter was required; the bug had appeared in 0.1.8.
2004-11-11nginx-0.1.5-RELEASE importrelease-0.1.5Igor Sysoev1-3/+3
*) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
2004-10-21nginx-0.1.2-RELEASE importrelease-0.1.2Igor Sysoev1-7/+21
*) Feature: the --user=USER, --group=GROUP, and --with-ld-opt=OPTIONS options in configure. *) Feature: the server_name directive supports *.domain.tld. *) Bugfix: the portability improvements. *) Bugfix: if configuration file was set in command line, the reconfiguration was impossible; the bug had appeared in 0.1.1. *) Bugfix: proxy module may get caught in an endless loop when sendfile is not used. *) Bugfix: with sendfile the response was not recoded according to the charset module directives; the bug had appeared in 0.1.1. *) Bugfix: very seldom bug in the kqueue processing. *) Bugfix: the gzip module compressed the proxied responses that was already compressed.
2004-09-29nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyrightIgor Sysoev1-1/+1
2004-09-28nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused filesIgor Sysoev1-1/+1
2004-09-16nginx-0.0.11-2004-09-16-20:10:13 importIgor Sysoev1-11/+28
2004-07-28nginx-0.0.9-2004-07-28-20:16:50 importIgor Sysoev1-1/+0
2004-07-02nginx-0.0.7-2004-07-02-19:54:34 importIgor Sysoev1-1/+1
2004-06-21nginx-0.0.7-2004-06-21-19:59:32 importIgor Sysoev1-38/+42
2004-06-20nginx-0.0.7-2004-06-20-23:54:15 importIgor Sysoev1-23/+56
2004-06-01nginx-0.0.3-2004-06-01-10:04:46 importIgor Sysoev1-2/+5
2004-05-28nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_tIgor Sysoev1-38/+38
2004-03-29nginx-0.0.3-2004-03-29-21:43:58 importIgor Sysoev1-3/+3
2004-03-16nginx-0.0.2-2004-03-16-10:10:12 importIgor Sysoev1-5/+5
2004-02-29nginx-0.0.2-2004-03-01-00:03:02 importIgor Sysoev1-0/+5
2004-02-20nginx-0.0.2-2004-02-20-19:48:59 importIgor Sysoev1-1/+2
2004-02-19nginx-0.0.2-2004-02-19-19:48:14 importIgor Sysoev1-18/+21
2004-02-18nginx-0.0.2-2004-02-18-18:45:21 importIgor Sysoev1-2/+2