194 Commits

Author SHA1 Message Date
Nick Mathewson
86f5742015 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
2009-11-16 22:25:46 +00:00
Nick Mathewson
c79a45e009 Fix a couple of event_debug calls.
svn:r1527
2009-11-14 21:54:30 +00:00
Nick Mathewson
37e23f806b Patch from Ryan Phillips: accept ipv6 addresses returned by getaddrinfo in http.c
svn:r1522
2009-11-09 18:50:20 +00:00
Nick Mathewson
784b8773a4 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
2009-11-06 21:46:57 +00:00
Nick Mathewson
ac633aebdf Fix some build warnings on MSVC, mostly related to signed/unsigned comparisons.
svn:r1510
2009-11-05 21:22:23 +00:00
Nick Mathewson
34f28e08b3 Fix a few types to use compatible versions
svn:r1501
2009-11-05 15:57:22 +00:00
Nick Mathewson
47bad8abb7 Implement size limits on HTTP header length and body length.
Patch from Constantine Verutin, simplified a little.

svn:r1500
2009-11-04 20:17:32 +00:00
Nick Mathewson
0b9eb1bffb 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
2009-11-03 20:40:48 +00:00
Nick Mathewson
2e36dbe1a6 Use EVUTIL_ASSERT() consistently instead of assert.
svn:r1464
2009-10-26 20:00:43 +00:00
Nick Mathewson
e3fd294a6d Spelling fixes in comments and strings.
svn:r1445
2009-10-16 13:19:57 +00:00
Nick Mathewson
2c1b0e4428 Fix build warnings and add changelog entry for evhttp patches.
svn:r1424
2009-08-16 19:22:15 +00:00
Nick Mathewson
c8b0fe4ad7 Define evhttp_del_accept_socket
[Patch from David Reiss]

svn:r1423
2009-08-16 19:22:10 +00:00
Nick Mathewson
6c53334c65 Define evhttp_{bind,accept}_socket_with_handle
[Patch from David Reiss]

svn:r1422
2009-08-16 19:22:04 +00:00
Nick Mathewson
4bcd5646d8 Make evhttp_bound_socket visible, and provide an accessor to its fd
Declare the previously private struct evhttp_bound_socket in
event2/http.h as an opaque struct.

Implement evhttp_bound_socket_get_fd, which returns the file descriptor
of an evhttp_bound_socket.

[Patch from David Reiss]

svn:r1421
2009-08-16 19:21:57 +00:00
Nick Mathewson
7c20a6ae52 Export an ev_socklen_t.
svn:r1391
2009-07-30 17:01:21 +00:00
Nick Mathewson
72ea534f8e Export evutil_str[n]casecmp as evutil_ascii_str[n]casecmp.
svn:r1387
2009-07-28 19:41:57 +00:00
Nick Mathewson
83f46e51d7 Do not use the "evbuffer_" prefix to denote parts of bufferevents.
This is a bit of an interface doozy, but it's really needed in order
to be able to document this stuff without apologizing it.  This patch
does the following renamings:

   evbuffercb -> bufferevent_data_cb
   everrorcb -> bufferevent_event_cb
   EVBUFFER_(READ,WRITE,...) -> BEV_EVENT_(...)
   EVBUFFER_(INPUT,OUTPUT) -> bufferevent_get_(input,output)

All the old names are available in event2/bufferevent_compat.h

svn:r1283
2009-05-13 20:36:56 +00:00
Nick Mathewson
f11dff2c7a Add and use locale-independent strcasecmp functions.
svn:r1280
2009-05-07 03:45:51 +00:00
Nick Mathewson
5a3eddf03f Use fewer _compat.h headers in our own code.
svn:r1268
2009-05-02 16:24:05 +00:00
Nick Mathewson
e865eb938c More msvc build tweaks.
svn:r1262
2009-05-01 00:54:14 +00:00
Nick Mathewson
c5c9589fb0 Add missing case to make http.c compile with warnings enabled.
svn:r1232
2009-04-23 06:27:58 +00:00
Nick Mathewson
9516df0e2e Fix c89 bugs reported by Cory Stup.
Others may remain.  I wasn't able to get gcc --std=c89 to build libevent
at all, so I don't know what compiler the original reporter is using here.

Note that this change requires us to disable the part of our rpc code
that uses variadic macros when using a non-gcc compiler.  This is a
problem if we want our rpc api to be portable.

svn:r1231
2009-04-23 05:40:06 +00:00
Nick Mathewson
a8f6d961eb Actually stop using EVBUFFER_LENGTH/DATA, and move them to buffer_compat.h
svn:r1183
2009-04-17 06:56:09 +00:00
Niels Provos
30648529e8 have evhttp_set_cb return an int; -1 on failure, 0 on success; this is better than returning a pointer
svn:r1179
2009-04-17 01:03:07 +00:00
Niels Provos
d2794e65e0 document evhttp_parse_query better
svn:r1157
2009-04-11 15:26:29 +00:00
Niels Provos
382a1587a0 previous commit changed the semantics of evhttp_decode_uri; need a test for that
svn:r1156
2009-04-11 04:18:49 +00:00
Niels Provos
ce146eb1cb Fix parsing of queries where the encoded queries contained \r, \n or +
svn:r1148
2009-04-10 05:43:45 +00:00
Niels Provos
6dece3e980 revert last commit; git user error
svn:r1147
2009-04-10 05:22:15 +00:00
Niels Provos
f43f1d14c5 initial version of query decoding patch
svn:r1146
2009-04-10 05:18:18 +00:00
Nick Mathewson
cd731b77d7 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
2009-02-10 21:40:12 +00:00
Nick Mathewson
deb2a1210b use new evutil_make_listen_socket_reuseable() in http.c
svn:r1103
2009-02-10 19:38:14 +00:00
Nick Mathewson
ea4b8724c0 checkpoint work on big bufferevent refactoring
svn:r1095
2009-02-02 19:22:13 +00:00
Nick Mathewson
7dd362b158 Have util-internal.h define socklen_t if we need it, and include it appropriately. This fixes win32 compilation.
svn:r1070
2009-01-29 15:09:24 +00:00
Nick Mathewson
b85b710cf5 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
2009-01-27 22:34:36 +00:00
Nick Mathewson
8889a77039 Replace all use of config.h with event-config.h.
svn:r1064
2009-01-27 22:30:46 +00:00
Nick Mathewson
9993137cbb Remove all trailing whitespace in all the source files.
svn:r1063
2009-01-27 21:10:31 +00:00
Niels Provos
5e796901c1 clean up buffered data on reset; reported by Brian O'Kelley
svn:r1015
2009-01-16 00:25:54 +00:00
Nick Mathewson
9935d5b01e Fix win32 compilation. Surprisingly, unit tests pass too.
svn:r1002
2009-01-13 21:39:32 +00:00
Nick Mathewson
169321c9e6 Rename four internal headers to follow the -internal.h convention.
svn:r1000
2009-01-13 20:26:37 +00:00
Nick Mathewson
81ab45add5 Use new EVUTIL_ERR_*_RETRIABLE macros when we're testing an errno for blocking.
Previously, we used inconsistent and incompletely ported ifdefs.
(We don't use these macros in platform-specific files like evpoll.c, since
they don't need to work on win32.)

svn:r995
2009-01-13 19:20:04 +00:00
Nick Mathewson
f37d1685df Include http_compat.h in http.c so we do not get warnings about functions with no prototypes.
svn:r981
2009-01-02 04:56:56 +00:00
Niels Provos
17bfc07e94 remove http_compat include
svn:r976
2008-12-23 22:38:01 +00:00
Niels Provos
02b2b4d1be Restructure the event backends so that they do not need to keep track of events themselves, as a side effect multiple events can use the same fd or signal.
svn:r972
2008-12-23 16:37:01 +00:00
Niels Provos
97cebce8fd the switch of bufferevents for http connections did not handle the EVBUFFER_ERROR case correctly
svn:r971
2008-12-23 14:53:55 +00:00
Niels Provos
f1728d94eb fix the close detection problem correctly by not running close detection on the server
svn:r968
2008-12-19 22:41:07 +00:00
Niels Provos
f700566cb9 Make the http connection close detection work properly with bufferevents and fix a potential memory leak associated with it
svn:r963
2008-12-19 21:31:43 +00:00
Niels Provos
5792d42f0f Allow setting of local port for evhttp connections to support millions of connections from a single system; from Richard Jones
svn:r948
2008-11-16 23:22:14 +00:00
Niels Provos
50202d757d only bind the socket on connect when a local address has been provided; reported by Ajejo Sanchez
svn:r946
2008-11-15 05:27:23 +00:00
Niels Provos
b3d6a569e7 do not remove accept-encoding header in make request
svn:r938
2008-09-07 23:24:54 +00:00
Nick Mathewson
de069b9977 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
2008-09-05 16:29:56 +00:00