summaryrefslogtreecommitdiff
path: root/network_io
Commit message (Collapse)AuthorAgeFilesLines
* merge r1551659 from trunk:trawick2013-12-171-1/+14
| | | | | | | | | | | | | | | | | | | | | | | Fix the inheritance of the non-blocking option across apr_socket_accept() on FreeBSD 10 which was introduced with APR 1.5.0 through an unlikely mechanism: * FreeBSD 10 introduced accept4(). APR uses accept4() where it can find it. accept4() on Linux and FreeBSD 10 both have a SOCK_NONBLOCK flag, but on FreeBSD 10 the SOCK_NONBLOCK is the sole determiner of whether or not the connected socket is non-blocking. * clang is normally used on FreeBSD 10. * APR's configure-time check for inherited O_NONBLOCK didn't work with clang, so initially the lack of inheritance across accept4() wasn't a problem. * APR 1.5.0 allowed the configure-time check to work with clang, exposing the bad expectation about accept4() matching the accept() behavior. With FreeBSD accept4() (avail in 10+), O_NONBLOCK is not inherited (unlike Linux). Mimic the accept() behavior here in a way that may help other platforms as well. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1551672 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1543056 from trunk:jim2013-11-181-5/+1
| | | | | | | | | | | | | | Follow up to r1543033: Use the new code required for OS X/Darwin on the other platforms too. (IOW, we're willing to peek in the socket as long as APR_POLLIN is returned, regardless of other flags.) Submitted by: trawick Reviewed/backported by: jim git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1543057 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1543033 from trunk:jim2013-11-181-0/+5
| | | | | | | | | | OSX (Darwin) returns APR_POLLHUP|APR_POLLIN, so the test for equality fails. Instead, just check for the bit. Reviewed/backported by: jim git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1543034 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1541061 from trunk:trawick2013-11-121-0/+29
| | | | | | | add apr_sockaddr_is_wildcard() API git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1541078 13f79535-47bb-0310-9956-ffa450edef68
* Merge 1089031 from trunk:trawick2013-10-271-39/+67
| | | | | | | | | | | | | restructure Windows apr_socket_connect() to more closely match the Unix implementation, fixing the getpeername() optimization and WSAEISCONN behavior PR: 48736 (covered WSAISCONN issue) Submitted by: <inoue ariel-networks.com> (WSAISCONN handling) Reworked/extended by: trawick git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1536167 13f79535-47bb-0310-9956-ffa450edef68
* Merge apr 1.x bits of r1084662 from trunk:trawick2013-10-211-1/+1
| | | | | | | fix extra "the" in comments and license text git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1534109 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1523384 and r1523615 from trunk:trawick2013-10-101-1/+2
| | | | | | | | | | | | On Windows, a socket timeout isn't implemented with non-blocking socket + poll. When a socket is non- blocking and a timeout is set, the non-blocking state must be disabled. (plus the subsequent fix to adjust the socket state) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1531094 13f79535-47bb-0310-9956-ffa450edef68
* merge r1081495 from trunk:trawick2013-10-101-1/+1
| | | | | | | return apr_get_netos_error() when setsockopt() fails git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1531093 13f79535-47bb-0310-9956-ffa450edef68
* Merge 1487796 from trunk:jorton2013-05-301-2/+10
| | | | | | | | | * network_io/unix/multicast.c (do_mcast_opt): Fix regression in handling IPv4 options introduced in r1309386. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1487797 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1460179:sf2013-05-031-3/+0
| | | | | | | | | | fix warning: parameter 'flags' set but not used (Linux sendfile has no flags, anyway) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1478924 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1438958:sf2013-05-031-1/+8
| | | | | | | Only fill in apr_sockaddr_vars_set if we have valid data git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1478918 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1478905:sf2013-05-031-1/+15
| | | | | | | | | | | | Make sure apr_sockaddr_info_get() returns an error if - getaddrinfo() returned only useless entries - getaddrinfo() returned EAI_SYSTEM but errno == 0 - gethostbyname() returns no error but an empty address list Submitted by: Jan Kaluža <jkaluza redhat com>, Stefan Fritsch git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1478909 13f79535-47bb-0310-9956-ffa450edef68
* Merge 1405985 from trunk:jorton2012-12-111-2/+2
| | | | | | | | | | | | * network_io/unix/sockaddr.c (apr_ipsubnet_test): Fix false positive when testing a v4 subnet against a v6 address. * test/testipsub.c (test_interesting_subnets): Add test. PR: 54047 git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1420111 13f79535-47bb-0310-9956-ffa450edef68
* merge r1406690 from trunk:trawick2012-11-071-2/+19
| | | | | | | | | | | | apr_socket_accept_filter: Return success when trying to again set the filter to the same value as before. Use apr_cpystrn(). PR: 37863 (warning message from Apache httpd during restart) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1406693 13f79535-47bb-0310-9956-ffa450edef68
* corresponding roughly to trunk r1405402:trawick2012-11-031-2/+6
| | | | | | | | | add apr_socket_accept_filter() notes on the name and args parameters, which should have been declared as const char * git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1405403 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1343243:sf2012-05-281-1/+4
| | | | | | | | | Guard against EAI_ADDRFAMILY not being defined, it seems to be glibc specific git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1343244 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1343233:sf2012-05-281-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve handling of AI_ADDRCONFIG with getaddrinfo() Using AI_ADDRCONFIG involves some unfortunate guesswork because it does not consider loopback addresses when trying to determine if IPv4 or IPv6 is configured (RFC 3493). This is a problem if one actually wants to listen on or connect to the loopback address of a protocol family that is not otherwise configured on the system. Also, some implementations (glibc, cough) behave strangely if no other addresses besides 127.0.0.1 and ::1 are configured. A real fix would enhance apr_sockaddr_info_get's interface to allow the caller to specify if he wants to use the address for listen() or connect(), and if he wants to make the result dependant on the presence of non-loopback addresses. Then apr_sockaddr_info_get could pass the right combination of AI_ADDRCONFIG and AI_PASSIVE to getaddrinfo(). As a workaround, retry getaddrinfo() without AI_ADDRCONFIG in case of EAI_ADDRFAMILY. This solves the most common problems but not all corner cases. PR: 52709 Submitted by: Nirgal Vourgère <jmv_deb nirgal com>, Stefan Fritsch Many thanks also to Aurelien Jarno for helping to debug this. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1343236 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1341196:sf2012-05-281-2/+2
| | | | | | | | | | | | If we retry getaddrinfo() without AI_ADDRCONFIG, we should really only remove AI_ADDRCONFIG and not all flags. When the retry logic was added in r64571, this was equivalent because not other flags were set. But this has changed since then. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1343234 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1340470:sf2012-05-191-1/+1
| | | | | | | Hurd's sendfile works like Linux's git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1340471 13f79535-47bb-0310-9956-ffa450edef68
* Backport fix for apr_mcast_hops returning EINVAL from trunkmturk2012-04-041-10/+5
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1309412 13f79535-47bb-0310-9956-ffa450edef68
* Backport r1183693:sf2011-10-153-0/+26
| | | | | | | | | | Add support for APR_SO_BROADCAST PR: 46389 Submitted by: Armin Müller <mueller itestra com> git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1183717 13f79535-47bb-0310-9956-ffa450edef68
* grab 1091757 from trunk:trawick2011-04-132-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IPV6_V6ONLY on Windows: * Deal with SDKs which don't have the symbol definition * Deal with old run-time platforms which don't implement the option and have hard-coded behavior internally (option always on) Behavior changes: run on Windows >= Vista, SDK has IPV6_V6ONLY: no change in behavior run on Windows >= Vista, SDK doesn't have IPV6_V6ONLY: works just like SDK had the def'n (will return APR_SUCCESS on IPv6 socket instead of WSAENOPROTOOPT) run on Windows < Vista, regardless of SDK: socket_opt_get/set(APR_IPV6_V6ONLY) reflect stack behavior (always on) previously, if IPV6_V6ONLY was defined: set returned WSAENOPROTOOPT previously, if IPV6_V6ONLY was not defined: set returned APR_ENOTIMPL previously, regardless of IPV6_V6ONLY presence: get returned not-enabled now: get always returns enabled; set returns APR_SUCCESS when enabling, APR_ENOTIMPL when trying to disable PR: 45321 Submitted by: Sob <sob hisoftware.cz> Tweaked by: trawick git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1091824 13f79535-47bb-0310-9956-ffa450edef68
* Grab r1088352 from trunk:trawick2011-04-041-0/+1
| | | | | | | | Windows: Save a call to getpeername() when trying to retrieve the remote address of a socket created by apr_socket_accept() git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1088568 13f79535-47bb-0310-9956-ffa450edef68
* from jorton's trunk r1059351:trawick2011-03-231-1/+7
| | | | | | | | | | | | * network_io/unix/sockets.c (apr_socket_accept): Ensure the correct address family is used for the new socket when adjusting local_addr/remote_addr, fixing handling of an AF_INET socket accepted from a bound AF_INET6 socket. PR: 49678 git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1084669 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1083931 from trunk:trawick2011-03-211-2/+4
| | | | | | | | | | | | | | | | | | | use apr_get_netos_error() to retrieve the getaddrinfo() error code on Windows before: error: 681001/APR does not understand this error code after: error: 731001/No such host is known. (the latter matches an IPv4-only build) Submitted by: Ivan Zhakov <ivan visualsvn.com> Reviewed by: trawick git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1083933 13f79535-47bb-0310-9956-ffa450edef68
* merge trunk revs 1083169, 1083177, 1083178, 1083183, and 1083227trawick2011-03-211-1/+1
| | | | | | | | | | to resolve some gcc warnings and dead code on Windows (the testlfsabi change from r1083183 is omitted, as the testcases aren't in this branch) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1083869 13f79535-47bb-0310-9956-ffa450edef68
* merge r949209 from trunktrawick2011-03-212-1/+2
| | | | | | | axe unused variables git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1083803 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1081120 from trunk:trawick2011-03-131-6/+16
| | | | | | | | | | | | | | apr_sockaddr_info_get() on AIX: Fix a problem which could set the port field in the native socket address to 1 when 0 was specified. An AIX-specific hack to work around a service name limitation used "1" as the service name, but the 1 was not replaced later. PR: 46964 git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1081121 13f79535-47bb-0310-9956-ffa450edef68
* Make functions static (backport r991753).fuankg2011-03-101-2/+2
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1080106 13f79535-47bb-0310-9956-ffa450edef68
* Merge r983618 from trunk:rpluem2010-08-201-3/+6
| | | | | | | | | | | | | | | | | | * network_io/unix/sockets.c (apr_socket_connect): Copy the remote address by value rather than by reference. This ensures that the sockaddr object returned by apr_socket_addr_get is allocated from the same pool as the socket object itself, as apr_socket_accept does; avoiding any potential lifetime mismatches. * test/testsock.c (test_get_addr): Enhance test case to cover this. PR: 49713 Submitted by: jorton Reviewed by: rpluem git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@987532 13f79535-47bb-0310-9956-ffa450edef68
* Merge r793193 from trunk:rpluem2010-08-201-3/+5
| | | | | | | | | | | | | | | | | | | Fix apr_socket_addr_get() in combination with async connects, for the APR_LOCAL case. Before it would return 0.0.0.0:0, instead of the actual local address/port. TODO: Fix win32 in a similar fashion; though maybe it's better to assume the local address is unknown by default... * network_io/unix/sockets.c (apr_socket_connect): Move address determination, or rather determining that the local address is unknown, to before returning because of e.g. EINPROGRESS. Submitted by: striker Reviewed by: rpluem git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@987524 13f79535-47bb-0310-9956-ffa450edef68
* Merge r835758 from trunk:rpluem2009-11-131-1/+1
| | | | | | | | | | * Add missing APR_DECLARE for apr_socket_atreadeof Submitted by: rpluem Reviewed by: rpluem git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@835759 13f79535-47bb-0310-9956-ffa450edef68
* Backport r831641 from the trunk.bojan2009-11-011-2/+10
| | | | | | | Set file/socket descriptor to -1 before close(), so that there is no chance of returning an already closed FD from apr_os_file_get()/apr_os_sock_get(). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@831642 13f79535-47bb-0310-9956-ffa450edef68
* Merge r821524, r822431, r822892, r824500 from trunk:rpluem2009-10-163-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add apr_socket_is_connected to detect whether the remote side of a socket is still open. The origin of apr_socket_is_connected is r473278 from http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c in httpd. * Improve the documentation Suggested by: jorton * Improve the documentation even further Reviewed by: jim * include/apr_network_io.h, * network_io/unix/socket_util.c (apr_socket_atreadeof): Renamed from apr_socket_is_connected; adjusted to return an apr_status_t error code, and pass an "at EOF" flag via an output parameter. * test/testsock.c (test_atreadeof): Renamed from test_is_connected, adjusted for new API. Reviewed by: jorton, rpluem git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@826089 13f79535-47bb-0310-9956-ffa450edef68
* Backport r747990, r748361, r748371, r748565, r748988, r749810, r783958bojan2009-06-121-6/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | from the trunk. Set CLOEXEC flags where appropriate. Either use new O_CLOEXEC flag and associated functions, such as dup3(), accept4(), epoll_create1() etc., or simply set CLOEXEC flag using fcntl(). Patch by Stefan Fritsch <sf sfritsch.de> and Arkadiusz Miskiewicz <arekm pld-linux.org>. PR 46425. fix unused variable warning for builds without HAVE_DUP3 Unroll APR_SET_FD_CLOEXEC macro. * One missing unroll of APR_SET_FD_CLOEXEC. Document CLOEXEC patch. Only set CLOEXEC on dup() if both NOCLEANUP and INHERIT flags are clear. Retain the INHERIT/NOCLEANUP flags of new_file in apr_file_dup2(). Patch by Stefan Fritsch <sf sfritsch.de>. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@783970 13f79535-47bb-0310-9956-ffa450edef68
* Backport r746115 from the trunk.bojan2009-02-201-0/+4
| | | | | | | | Fix compilation error on systems that do not have IPV6. Patch by Julien Charbon <jch 4js.com>. PR 46601. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@746117 13f79535-47bb-0310-9956-ffa450edef68
* backport r739640 from trunktrawick2009-02-011-0/+8
| | | | | | | | | | | | apr_socket_sendfile() on Solaris: Fix handling of files truncated after the sender determines the length. (This fixes a busy loop in httpd when a file being served is truncated.) Some other implementations of apr_socket_sendfile() were already patched along the way to handle this; some apparently remain broken. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@739754 13f79535-47bb-0310-9956-ffa450edef68
* Fix PR44367.bojan2008-05-291-0/+46
| | | | | | | | | | | | Caveats: - no idea if IBM's proprietary OSes actually have thread-safe version of getservbyname() function, just assumed that by looking at other similar functions being marked safe in APR detection code - works on Linux (Fedora 9, i.e. glibc2) Use thread safe versions of getservbyname(). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@661178 13f79535-47bb-0310-9956-ffa450edef68
* Fix PR44971.bojan2008-05-271-1/+1
| | | | | | Return APR_ENOENT if we cannot find service, errno is undefined. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@660405 13f79535-47bb-0310-9956-ffa450edef68
* Darwin sendfile() cleanup.jim2008-05-151-8/+3
| | | | | | | | | | | | | | | | First, remove extra code. Secondly, don't update len and offset within this loop; we just want to check for errors and finally: When using a socket marked for non-blocking I/O, sendfile() may send fewer bytes than requested. In this case, the number of bytes successfully sent is returned in the via the len parameters and the error EAGAIN is returned. so when this happens, return with a success anytime we've sent data. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@656659 13f79535-47bb-0310-9956-ffa450edef68
* Bypass the call to sendfile if *len is 0. Thisjim2008-05-141-0/+3
| | | | | | | means we just worry about the footers. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@656355 13f79535-47bb-0310-9956-ffa450edef68
* Restructure Darwin's sendfile impl again. Instead of writev(),jim2008-05-091-66/+70
| | | | | | | | | | go ahead and use apr_socket_sendv(), which handles things much more cleanly, keeping the sendfile() stuff nicely contained. Yes, this is similar to how the Linux impl does it :) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@654788 13f79535-47bb-0310-9956-ffa450edef68
* this should not have been committed with the CHANGES patchjim2008-05-071-1/+0
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@654251 13f79535-47bb-0310-9956-ffa450edef68
* Oops... forgot to combine the CHANGES :)jim2008-05-071-3/+4
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@654247 13f79535-47bb-0310-9956-ffa450edef68
* Make Darwin's sendfile() really work :)jim2008-05-071-1/+0
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@654185 13f79535-47bb-0310-9956-ffa450edef68
* apr_getservbyname(): Use proper method for converting porttrawick2008-05-021-1/+1
| | | | | | | | | | | | | to host byte order. PR 44903. Submitted by: Chris Taylor <ctaylor wadeford.plus.com> Reviewed by: trawick git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@652951 13f79535-47bb-0310-9956-ffa450edef68
* Optimize away a second poll by simply looping on the existing pollwrowe2008-05-011-7/+3
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@652692 13f79535-47bb-0310-9956-ffa450edef68
* Reflow the OS/X sendfile implementation to proceed from writev(hd..iovec)wrowe2008-05-011-16/+23
| | | | | | | | | | | to the sendfile/tr..iovec series, tallying these correctly. Submitted by: Geoff Greer <angryparsley mipsisrisc.com> and wrowe git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@652690 13f79535-47bb-0310-9956-ffa450edef68
* Correct legacy crumbs from the new OS/X sendfile changes.wrowe2008-04-251-5/+2
| | | | | | | Submitted by: Geoff Greer <angryparsley mipsisrisc.com>] git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@651651 13f79535-47bb-0310-9956-ffa450edef68
* Support OS/X sendfile by using writev rather than the miscounted sendfile'swrowe2008-04-241-12/+26
| | | | | | | | | hdtr iovecs. Submitted by: Geoff Greer <angryparsley mipsisrisc.com> git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@651395 13f79535-47bb-0310-9956-ffa450edef68