evutil.c


Log

Author Commit Date CI Message
Nick Mathewson 5c7a7bca 2010-01-23T20:07:05 Fix windows and msvc build
Nick Mathewson 918e9c5e 2010-01-23T16:38:36 Fix a number of warnings from gcc -pedantic
Nick Mathewson 26e1b6f2 2010-01-21T01:51:40 Remove some commented-out code in evutil
Nick Mathewson 8d4aaf90 2010-01-20T12:56:54 Don't use a bind address for nameservers on loopback If the user sets a bind address to use for nameservers, and a nameserver happens to be on 127.0.0.1, the nameserver will generally fail. This patch alters this behavior so that the bind address is only applied when the nameserver is on a non-loopback address.
Nick Mathewson 0f7144fd 2009-12-07T17:21:13 Refactor code from evdns into a new internal "read a file" function.
Nick Mathewson ba2945f9 2010-01-06T17:59:44 Merge branch 'ratelimit' Conflicts: bufferevent_async.c
Nick Mathewson 165d30e3 2009-12-30T14:29:56 Fix compilation of rate-limiting code on win32.
Jardel Weyrich d0939d2b 2009-12-29T16:21:26 Introduced evutil_make_socket_closeonexec() to preserve fd flags for F_SETFD. Use this to eliminate the various macros that called F_SETFD throughout the code.
Jardel Weyrich 4df7dbcb 2009-12-29T16:19:24 Adjusted fcntl() retval comparison on evutil_make_socket_nonblocking(). Apparently, a successful return value on F_SETFL is "anything but -1".
Jardel Weyrich 5a43df82 2009-12-28T16:03:47 Improve readability of evutil_unparse_protoname()
Jardel Weyrich 0d64051f 2009-12-28T16:01:59 Fix a bogus free in evutil_new_addrinfo()
Jardel Weyrich 4c8b7cdc 2009-12-28T16:00:05 Make evutil_make_socket_nonblocking() leave any other flags alone. Fixes bug 2922121
Nick Mathewson f070a4ae 2009-11-18T23:18:55 Do the proper hack for the (Open)BSD getaddrinfo quirk. From evutil.c: Some older BSDs (like OpenBSD up to 4.6) used to believe that giving a numeric port without giving an ai_socktype was verboten. We test for this so we can apply an appropriate workaround. If it turns out that the bug is present, then: - If nodename==NULL and servname is numeric, we build an answer ourselves using evutil_getaddrinfo_common(). - If nodename!=NULL and servname is numeric, then we set servname=NULL when calling getaddrinfo, and post-process the result to set the ports on it. We test for this bug at runtime, since otherwise we can't have the same binary run on multiple BSD versions. svn:r1550
Nick Mathewson 201d8d0b 2009-11-17T18:29:44 Clarify even more about various system-specific problems with getaddrinfo svn:r1542
Nick Mathewson 9151d000 2009-11-17T03:36:43 Use the common-case code from getaddrinfo_common *always*; OS differences are just too huge. svn:r1541
Nick Mathewson 3451c870 2009-11-17T02:57:32 Never pass our weird flags to the system getaddrinfo. Make sure there is no overlap between flag values. svn:r1540
Nick Mathewson 888007f9 2009-11-17T02:38:19 Windows *does* have getservbyname, no matter what autoconf says. TODO: figure out why autoconf is confused about this. svn:r1538
Nick Mathewson 86f57420 2009-11-16T22:25:46 Add two implementations of getaddrinfo: one blocking and one nonblocking. The entry points are evutil_getaddrinfo and evdns_getaddrinfo respectively. There are fairly extensive unit tests. I believe this code conforms to RFC3493 pretty closely, but there are probably more issues. It should get tested on more platforms. This code means we can dump the well-intentioned but weirdly-implemented bufferevent_evdns and evutil_resolve code. svn:r1537
Nick Mathewson 629a6133 2009-11-15T18:59:59 When running set[ug]id, don't check the environment. Idea from OpenBSD, but made a bit more generic to handle uncivilized lands that do not define issetugid. svn:r1530
Nick Mathewson 784b8773 2009-11-06T21:46:57 We do not work any more without an event-config.h; stop pretending that it is meaningful to check for HAVE_CONFIG_H svn:r1516
Nick Mathewson 0b9eb1bf 2009-11-03T20:40:48 Add a bufferevent function to resolve a name then connect to it. This function, bufferevent_socket_connect_hostname() can either use evdns to do the resolve, or use a new function (evutil_resolve) that uses getaddrinfo or gethostbyname, like http.c does now. This function is meant to eventually replace the hostname resolution mess in http.c. svn:r1496
Nick Mathewson 25af6954 2009-10-14T00:46:47 When a bufferevent_connect() call fails, give the client an error callback. Patch from Christopher Davis. svn:r1444
Nick Mathewson 621aafd2 2009-07-30T22:11:23 Export sockaddr comparison functionality. svn:r1400
Nick Mathewson 7c20a6ae 2009-07-30T17:01:21 Export an ev_socklen_t. svn:r1391
Nick Mathewson 72ea534f 2009-07-28T19:41:57 Export evutil_str[n]casecmp as evutil_ascii_str[n]casecmp. svn:r1387
Nick Mathewson 709c21c4 2009-07-28T04:03:57 Bufferevent support for openssl. This code adds a new Bufferevent type that is only compiled when the openssl library is present. It supports using an SSL object and an event alert mechanism, which can either be an fd or an underlying bufferevent. There is still more work to do: the unit tests are incomplete, and we need to support flush and shutdown much better. Sometimes events are generated needlessly: this will hose performance. There's a new encrypting proxy in sample/le-proxy.c. This code has only been tested on OSX, and nowhere else. svn:r1382
Nick Mathewson 043515bc 2009-07-14T18:50:06 Stop using C++ style comments. svn:r1343
Nick Mathewson 01be8708 2009-06-11T19:09:08 Fix compile on cygwin. This isnt the solution I would like: I would prefer to get pton and ntop to work even when AF_INET6 is not defined. svn:r1326
Nick Mathewson f11dff2c 2009-05-07T03:45:51 Add and use locale-independent strcasecmp functions. svn:r1280
Nick Mathewson ebf29455 2009-04-30T23:49:15 Compilation fixes for vc++ 2008 express. Not the end of them. svn:r1260
Nick Mathewson 50e20fe0 2009-04-29T20:48:35 fix a typo in a comment svn:r1251
Nick Mathewson a835c7cf 2009-04-18T18:27:56 fix a misindent svn:r1200
Nick Mathewson acaf65c3 2009-02-11T17:23:32 Make evutil_parse_sockaddr_port give a useful socket-length output. svn:r1118
Nick Mathewson cd731b77 2009-02-10T21:40:12 Do not use ctypes functions in cases when we need the "net" locale. This patch adds a new set of EVUTIL_IS* functions to replace use of the ctypes is* functions in all cases where we care about characters' interpretations in net ascii rather than in the locale. For example, when we're working with DNS hostnames, we don't want to do the 0x20 hack on non-ascii characters, even if the host thinks they should be isalpha. svn:r1114
Nick Mathewson da49d6a3 2009-02-10T19:43:11 Stop using platform inet_aton/inet_addr; they can behave strangely on certain misformed addresses. svn:r1111
Nick Mathewson c7b2f8fd 2009-02-10T19:38:05 New function to abstract SO_REUSEADDR. svn:r1102
Nick Mathewson 722885fb 2009-02-02T21:59:53 Some mingws have AF_UNIX, which may have prevented our socketpair from working at all on them. Fix that. svn:r1098
Nick Mathewson f13bede7 2009-01-28T20:31:19 Fix an unlikely degenerate case of evutil_vsnprintf svn:r1067
Nick Mathewson b85b710c 2009-01-27T22:34:36 Update copyright statements to reflect the facts that: a) this is 2009 b) niels and nick have been comaintainers for a while c) saying "all rights reserved" when you then go on to explicitly disclaim some rights is sheer cargo-cultism. svn:r1065
Nick Mathewson 8889a770 2009-01-27T22:30:46 Replace all use of config.h with event-config.h. svn:r1064
Nick Mathewson 9993137c 2009-01-27T21:10:31 Remove all trailing whitespace in all the source files. svn:r1063
Niels Provos 70405e3c 2009-01-21T07:18:31 fix freebsd compile; from Alexander Drozdov svn:r1030
Nick Mathewson 9935d5b0 2009-01-13T21:39:32 Fix win32 compilation. Surprisingly, unit tests pass too. svn:r1002
Nick Mathewson 169321c9 2009-01-13T20:26:37 Rename four internal headers to follow the -internal.h convention. svn:r1000
Nick Mathewson 980bcd68 2009-01-02T21:21:58 Work better with platforms that do not have ipv6 structures, or that do not have sin_len fields, etc. svn:r986
Nick Mathewson cfbd1680 2009-01-02T20:46:26 Add another function to parse the common address:port combination formats into a sockaddr. svn:r984
Nick Mathewson 0d9d5cfe 2009-01-02T20:46:12 New functions in evutil to clone inet_pton and inet_ntop, with tests. Adapted from Tor code. svn:r983
Nick Mathewson fded0a87 2008-09-05T16:47:04 Fix compilation of recent error code with win32. svn:r937
Nick Mathewson de069b99 2008-09-05T16:29:56 On win32, errno is not the last socket error. Worse, WSAGetLastError() is not the last socket error sometimes (i.e., EWOULDBLOCK). Also, strerror() does not handle winsock errors. Therefore, event_err() and event_warn() are completely wrong for windows socket errors. Fix that. svn:r936
Niels Provos 55f91494 2008-06-24T16:29:02 fix evutil_snprintf on windows svn:r860
Nick Mathewson 0cafdeb6 2008-05-12T17:16:47 Tweaks to make unit tests fail less badly on mingw on trunk. svn:r814
Nick Mathewson c6da86ff 2008-05-12T16:44:24 r19709@catbus: nickm | 2008-05-12 12:42:48 -0400 Possible fix for [1960723] snprintf and vsnprintf return values are wrong on win32 svn:r813
Nick Mathewson 7868ab5a 2008-05-09T04:00:17 r19667@catbus: nickm | 2008-05-08 23:49:26 -0400 fwd-port: Always include winsock2.h before windows.h. Apparently some SDKs need this. svn:r803
Nick Mathewson 3d60bccc 2008-05-08T14:25:44 r19656@catbus: nickm | 2008-05-08 10:25:08 -0400 forward-port: Remove #include "misc.h"s. svn:r795
Nick Mathewson a26442c5 2008-05-08T14:06:33 r19649@catbus: nickm | 2008-05-08 10:00:14 -0400 Replace gettimeofday() usage with a new evutil_gettimeofday(). This removes all previous need for win32-code/misc.[ch] svn:r792
Nick Mathewson 0ac73078 2008-04-16T20:01:51 r15193@tombo: nickm | 2008-04-16 16:00:35 -0400 Split event.h into several new headers in include/event2. event.h is now just a wrapper that includes all the subheaders. svn:r711
Nick Mathewson 807ab182 2008-02-16T20:49:47 r14211@tombo: nickm | 2008-02-16 15:28:54 -0500 Add new evutil_strtoll() function so we can apply 64-bit content-length patch from Scott Lamb in a portable way. svn:r640
Nick Mathewson 1120f04f 2007-11-25T21:53:06 r16731@catbus: nickm | 2007-11-25 16:52:53 -0500 Replace all fds on non-unix-specific APIs with evutil_socket_t, which is int on unix and intptr_t on win32. svn:r552
Nick Mathewson e1f09dfe 2007-10-12T17:55:37 Fix evutil code to use correct EVUTIL_SET_SOCKET_ERROR macro. svn:r460
Nick Mathewson fe482977 2007-09-24T16:26:11 r15324@catbus: nickm | 2007-09-24 12:22:21 -0400 New evutil.h macros to manipulate winsock errors. Use them in http.c and in evutil_socketpair(). svn:r451
Nick Mathewson d85bce4e 2007-09-20T18:38:31 Remove gratuitous tor-isms in evutil_socketpair(); fix a windows warning in http.c. svn:r446
Nick Mathewson 25007183 2007-09-20T18:26:40 r15216@catbus: nickm | 2007-09-20 13:58:23 -0400 Add a new evutil module to contain the usual cross-platform hacks: socketpair, closesocket, and make_socket_nonblocking() svn:r441