aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_recv.c
Commit message (Collapse)AuthorAge
* Fixed runtime handling of systems without EPOLLRDHUP support.Marcus Ball2022-05-30
| | | | | | | | | | | | | | | | | | | | | | In 7583:efd71d49bde0 (nginx 1.17.5) along with introduction of the ioctl(FIONREAD) support proper handling of systems without EPOLLRDHUP support in the kernel (but with EPOLLRDHUP in headers) was broken. Before the change, rev->available was never set to 0 unless ngx_use_epoll_rdhup was also set (that is, runtime test for EPOLLRDHUP introduced in 6536:f7849bfb6d21 succeeded). After the change, rev->available might reach 0 on systems without runtime EPOLLRDHUP support, stopping further reading in ngx_readv_chain() and ngx_unix_recv(). And, if EOF happened to be already reported along with the last event, it is not reported again by epoll_wait(), leading to connection hangs and timeouts on such systems. This affects Linux kernels before 2.6.17 if nginx was compiled with newer headers, and, more importantly, emulation layers, such as DigitalOcean's App Platform's / gVisor's epoll emulation layer. Fix is to explicitly check ngx_use_epoll_rdhup before the corresponding rev->pending_eof tests in ngx_readv_chain() and ngx_unix_recv().
* Events: available bytes calculation via ioctl(FIONREAD).Maxim Dounin2019-10-17
| | | | | | | | | | | | | | | | | | | | | This makes it possible to avoid looping for a long time while working with a fast enough peer when data are added to the socket buffer faster than we are able to read and process them (ticket #1431). This is basically what we already do on FreeBSD with kqueue, where information about the number of bytes in the socket buffer is returned by the kevent() call. With other event methods rev->available is now set to -1 when the socket is ready for reading. Later in ngx_recv() and ngx_recv_chain(), if full buffer is received, real number of bytes in the socket buffer is retrieved using ioctl(FIONREAD). Reading more than this number of bytes ensures that even with edge-triggered event methods the event will be triggered again, so it is safe to stop processing of the socket and switch to other connections. Using ioctl(FIONREAD) only after reading a full buffer is an optimization. With this approach we only call ioctl(FIONREAD) when there are at least two recv()/readv() calls.
* Improved EPOLLRDHUP handling.Valentin Bartenev2016-05-13
| | | | | | | | | | | | | | | | | When it's known that the kernel supports EPOLLRDHUP, there is no need in additional recv() call to get EOF or error when the flag is absent in the event generated by the kernel. A special runtime test is done at startup to detect if EPOLLRDHUP is actually supported by the kernel because epoll_ctl() silently ignores unknown flags. With this knowledge it's now possible to drop the "ready" flag for partial read. Previously, the "ready" flag was kept until the recv() returned EOF or error. In particular, this change allows the lingering close heuristics (which relies on the "ready" flag state) to actually work on Linux, and not wait for more data in most cases. The "available" flag is now used in the read event with the semantics similar to the corresponding counter in kqueue.
* Simplified ngx_unix_recv() and ngx_readv_chain().Ruslan Ermilov2016-04-08
| | | | This makes ngx_unix_recv() and ngx_udp_unix_recv() differ minimally.
* Merged implementations of ngx_unix_recv().Valentin Bartenev2016-04-08
| | | | | There's no real need in two separate implementations, with and without kqueue support.
* Fixed small inconsistency in handling EOF among receive functions.Valentin Bartenev2016-04-08
| | | | Now all functions always drop the ready flag in this case.
* Fixed logging.Sergey Kandaurov2016-03-31
|
* Fixed handling of the ready flag with kqueue.Valentin Bartenev2013-09-05
| | | | | There is nothing to do more when recv() has returned 0, so we should drop the flag.
* Events: honor NGX_USE_GREEDY_EVENT when kqueue support is enabled.Valentin Bartenev2013-07-13
| | | | | | Currently this flag is needed for epoll and rtsig, and though these methods usually present on different platforms than kqueue, nginx can be compiled to support all of them.
* Copyright updated.Maxim Konovalov2012-01-18
|
* style fixIgor Sysoev2010-06-23
|
* reset ready flag if no data is available,Igor Sysoev2008-01-31
| | | | this fixes endless loop at least in lingering close
* axe old unused alert messageIgor Sysoev2007-12-01
|
* style fixIgor Sysoev2007-12-01
|
* nginx-0.3.35-RELEASE importrelease-0.3.35Igor Sysoev2006-03-28
| | | | | | | | *) Bugfix: the accept-filter and the TCP_DEFER_ACCEPT option were set for first "listen" directive only; the bug had appeared in 0.3.31. *) Bugfix: in the "proxy_pass" directive without the URI part in a subrequest.
* nginx-0.3.26-RELEASE importrelease-0.3.26Igor Sysoev2006-02-03
| | | | | | | | | *) Change: the "optimize_host_names" directive was renamed to the "optimize_server_names". *) Bugfix: if in the "proxy_pass" directive was no the URI part, then the main request URI was transferred to a backend while proxying the SSI subrequest.
* nginx-0.3.24-RELEASE importrelease-0.3.24Igor Sysoev2006-02-01
| | | | | | | | | | | | | | | | *) Workaround: for bug in FreeBSD kqueue. *) Bugfix: now a response generated by the "post_action" directive is not transferred to a client. *) Bugfix: the memory leaks were occurring if many log files were used. *) Bugfix: the first "proxy_redirect" directive was working inside one location. *) Bugfix: on 64-bit platforms segmentation fault may occurred on start if the many names were used in the "server_name" directives; the bug had appeared in 0.3.18.
* nginx-0.3.15-RELEASE importrelease-0.3.15Igor Sysoev2005-12-07
| | | | | | | | | | *) 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.
* nginx-0.3.13-RELEASE importrelease-0.3.13Igor Sysoev2005-12-05
| | | | | | | | | | | | | | | *) Feature: the IMAP/POP3 proxy supports STARTTLS and STLS. *) Bugfix: the IMAP/POP3 proxy did not work with the select, poll, and /dev/poll methods. *) Bugfix: in SSI handling. *) Bugfix: now Solaris sendfilev() is not used to transfer the client request body to FastCGI-server via the unix domain socket. *) Bugfix: the "auth_basic" directive did not disable the authorization; the bug had appeared in 0.3.11.
* nginx-0.3.12-RELEASE importrelease-0.3.12Igor Sysoev2005-11-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *) 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.
* nginx-0.1.43-RELEASE importrelease-0.1.43Igor Sysoev2005-08-30
| | | | | | | | | | | | | | | *) 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.
* nginx-0.1.9-RELEASE importrelease-0.1.9Igor Sysoev2004-11-25
| | | | | | | | | | | | | | | *) 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.
* nginx-0.1.2-RELEASE importrelease-0.1.2Igor Sysoev2004-10-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.
* nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyrightIgor Sysoev2004-09-29
|
* nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused filesIgor Sysoev2004-09-28
|
* nginx-0.0.7-2004-07-02-19:54:34 importIgor Sysoev2004-07-02
|
* nginx-0.0.3-2004-04-28-10:14:50 importIgor Sysoev2004-04-28
|
* nginx-0.0.3-2004-04-02-19:13:20 importIgor Sysoev2004-04-02
|
* nginx-0.0.2-2004-03-16-10:10:12 importIgor Sysoev2004-03-16
|
* nginx-0.0.2-2004-02-11-20:08:49 importIgor Sysoev2004-02-11
|
* nginx-0.0.2-2004-02-10-19:23:38 importIgor Sysoev2004-02-10
|
* nginx-0.0.2-2004-02-09-10:46:43 importIgor Sysoev2004-02-09
|
* nginx-0.0.1-2004-01-05-23:55:48 importIgor Sysoev2004-01-05
|
* nginx-0.0.1-2003-11-18-11:04:34 importIgor Sysoev2003-11-18
|
* nginx-0.0.1-2003-11-14-10:20:34 importIgor Sysoev2003-11-14
|
* nginx-0.0.1-2003-10-28-18:45:41 importIgor Sysoev2003-10-28
|
* nginx-0.0.1-2003-10-17-00:19:16 importIgor Sysoev2003-10-16
|
* nginx-0.0.1-2003-10-12-20:49:16 importIgor Sysoev2003-10-12
|
* nginx-0.0.1-2003-06-11-19:28:34 importIgor Sysoev2003-06-11
|
* nginx-0.0.1-2003-05-27-16:18:54 importIgor Sysoev2003-05-27
|
* nginx-0.0.1-2003-05-21-17:28:21 importIgor Sysoev2003-05-21
|
* nginx-0.0.1-2003-05-19-20:39:14 importIgor Sysoev2003-05-19