http.c


Log

Author Commit Date CI Message
Nick Mathewson c1cd32a1 2010-05-08T22:21:52 Define _REENTRANT as needed on Solaris, elsewhere It turns out that _REENTRANT isn't only needed to make certain functions visible; we also need it to make pthreads work properly some places (like Solaris, where forgetting _REENTRANT basically means that all threads are sharing the same errno). Fortunately, our ACX_PTHREAD() configure macro already gives us a PTHREAD_CFLAG variable, so all we have to do is use it.
Frank Denis 953e2290 2010-05-03T11:29:22 Refuse null keys in evhttp_parse_query() evhttp_parse_query() currently accepts empty keys, that don't make any sense. -Frank [From sourceforge patch 2995183] -Nick
Sebastian Hahn bd1ed5f3 2010-05-02T12:51:35 Fix a compile warning introduced in 739e688
Pierre Phaneuf 739e6882 2010-04-28T21:33:13 Allow empty reason line in HTTP status
Niels Provos 9d8edf2f 2010-04-23T18:59:22 do not leak the request object on persistent connections
Sebastian Sjöberg 899c1dcc 2010-04-14T15:42:57 Replace EVUTIL_CLOSESOCKET macro with a function The EVUTIL_CLOSESOCKET() macro required you to include unistd.h in your source for POSIX. We might as well turn it into a function: an extra function call is going to be cheap in comparison with the system call. We retain the EVUTIL_CLOSESOCKET() macro as an alias for the new evutil_closesocket() function. (commit message from email by Nick and Sebastian)
Brodie Thiesfield 13e4f3bd 2010-03-08T13:46:48 Avoid errors in http.c when building with VC 2003 .NET
Nick Mathewson c7cf6f00 2010-03-05T12:47:46 Replace users of "int fd" with "evutil_socket_t fd" in portable code Remeber, win32 has a socket type that's actually a handle, so if there's a chance that code is run on win32, we can't use "int" as the socket type. This isn't a blind search-and-replace: sometimes an fd is really in fact for a file, and not a socket at all.
Nick Mathewson 17efc1cd 2010-03-04T01:25:51 Update all our copyright notices to say "2010"
Nick Mathewson e5cf9879 2010-02-18T17:46:56 Clean up formatting: remove trailing spaces
Nick Mathewson e5bbd40a 2010-02-18T17:41:15 Clean up formatting: use tabs, not 8-spaces, to indent.
Nick Mathewson 8fdf09c0 2010-02-18T17:08:50 Clean up formatting: Disallow space-before-tab.
Nick Mathewson cfe7a9ff 2010-02-04T10:15:39 Merge remote branch 'niels/http_chunk'
Niels Provos 39781801 2010-02-03T16:54:18 make evhttp_send() safe against terminated connections, too
Nick Mathewson e2d15d81 2010-02-03T17:52:55 Merge remote branch 'niels/http_chunk'
Niels Provos 93d73691 2010-02-03T14:34:56 do not fail while sending on http connections the client closed. when sending chunked requests via multiple calls to evhttp_send_reply_chunk, the client may close the connection before the server is done sending. this used to cause a crash. we introduce a new function evhttp_request_get_connection() that allows the server to determine if the request is still associated with a connection. If it's not, evhttp_request_free() needs to be called explicitly or the user can call evhttp_send_reply_end() which just frees the request, too.
Nick Mathewson 8f654678 2010-02-03T16:25:34 Merge remote branch 'github/http_listener' Conflicts: http.c
Nick Mathewson a19b4a05 2010-01-25T13:38:07 Call event_debug_unassign on internal events I don't expect that many users will be so religious about calling unassign, but we need to be so that it's at least possible to use debug mode without eating memory.
Nick Mathewson 5c7a7bca 2010-01-23T20:07:05 Fix windows and msvc build
Nick Mathewson ff3f6cd4 2010-01-22T16:14:49 Check more internal event_add() calls for failure Most of these should be unable to fail, since adding a timeout generally always works. Still, it's better not to try to be "too smart for our own good here." There are some remaining event_add() calls that I didn't add checks for; I've marked those with "XXXX" comments.
Niels Provos 5032e526 2010-01-14T15:42:07 do not use a function to assign the evdns base; instead assign it via evhttp_connection_base_new() which is a new function introduced in 2.0
Nick Mathewson ec34533a 2009-12-30T00:41:03 Make http use evconnlistener. Now that we have a generic listen-on-a-socket mechanism, there's no longer any reason to have a separate listen-on-a-socket implementation in http.c. This also lets us use IOCP and AcceptEx() when they're enabled. Possibly, we should have a new mechanism to add a socket given only a listener.
Nick Mathewson c698b77d 2009-12-30T00:11:27 Allow http connections to use evdns for hostname looksups. This was as simple as using bufferevent_connect_hostname instead of calling connect() ourself, which already knows how to use an evdns_base if it gets one. Untangling the bind code might be a little trickier.
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.
Niels Provos f1691539 2009-11-19T23:08:50 Remove most calls to event_err() in http and deal with memory errors instead svn:r1555
Niels Provos b8f222e0 2009-11-19T21:14:31 On FreeBSD and other OSes, connect can return ECONREFUSED immediately; instead of failing the function call, pretend with faileld in the callback. svn:r1553
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 c79a45e0 2009-11-14T21:54:30 Fix a couple of event_debug calls. svn:r1527
Nick Mathewson 37e23f80 2009-11-09T18:50:20 Patch from Ryan Phillips: accept ipv6 addresses returned by getaddrinfo in http.c svn:r1522
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 ac633aeb 2009-11-05T21:22:23 Fix some build warnings on MSVC, mostly related to signed/unsigned comparisons. svn:r1510
Nick Mathewson 34f28e08 2009-11-05T15:57:22 Fix a few types to use compatible versions svn:r1501
Nick Mathewson 47bad8ab 2009-11-04T20:17:32 Implement size limits on HTTP header length and body length. Patch from Constantine Verutin, simplified a little. svn:r1500
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 2e36dbe1 2009-10-26T20:00:43 Use EVUTIL_ASSERT() consistently instead of assert. svn:r1464
Nick Mathewson e3fd294a 2009-10-16T13:19:57 Spelling fixes in comments and strings. svn:r1445
Nick Mathewson 2c1b0e44 2009-08-16T19:22:15 Fix build warnings and add changelog entry for evhttp patches. svn:r1424
Nick Mathewson c8b0fe4a 2009-08-16T19:22:10 Define evhttp_del_accept_socket [Patch from David Reiss] svn:r1423
Nick Mathewson 6c53334c 2009-08-16T19:22:04 Define evhttp_{bind,accept}_socket_with_handle [Patch from David Reiss] svn:r1422
Nick Mathewson 4bcd5646 2009-08-16T19:21:57 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
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 83f46e51 2009-05-13T20:36:56 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
Nick Mathewson f11dff2c 2009-05-07T03:45:51 Add and use locale-independent strcasecmp functions. svn:r1280
Nick Mathewson 5a3eddf0 2009-05-02T16:24:05 Use fewer _compat.h headers in our own code. svn:r1268
Nick Mathewson e865eb93 2009-05-01T00:54:14 More msvc build tweaks. svn:r1262
Nick Mathewson c5c9589f 2009-04-23T06:27:58 Add missing case to make http.c compile with warnings enabled. svn:r1232
Nick Mathewson 9516df0e 2009-04-23T05:40:06 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
Nick Mathewson a8f6d961 2009-04-17T06:56:09 Actually stop using EVBUFFER_LENGTH/DATA, and move them to buffer_compat.h svn:r1183
Niels Provos 30648529 2009-04-17T01:03:07 have evhttp_set_cb return an int; -1 on failure, 0 on success; this is better than returning a pointer svn:r1179
Niels Provos d2794e65 2009-04-11T15:26:29 document evhttp_parse_query better svn:r1157
Niels Provos 382a1587 2009-04-11T04:18:49 previous commit changed the semantics of evhttp_decode_uri; need a test for that svn:r1156
Niels Provos ce146eb1 2009-04-10T05:43:45 Fix parsing of queries where the encoded queries contained \r, \n or + svn:r1148
Niels Provos 6dece3e9 2009-04-10T05:22:15 revert last commit; git user error svn:r1147
Niels Provos f43f1d14 2009-04-10T05:18:18 initial version of query decoding patch svn:r1146
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 deb2a121 2009-02-10T19:38:14 use new evutil_make_listen_socket_reuseable() in http.c svn:r1103
Nick Mathewson ea4b8724 2009-02-02T19:22:13 checkpoint work on big bufferevent refactoring svn:r1095
Nick Mathewson 7dd362b1 2009-01-29T15:09:24 Have util-internal.h define socklen_t if we need it, and include it appropriately. This fixes win32 compilation. svn:r1070
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 5e796901 2009-01-16T00:25:54 clean up buffered data on reset; reported by Brian O'Kelley svn:r1015
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 81ab45ad 2009-01-13T19:20:04 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
Nick Mathewson f37d1685 2009-01-02T04:56:56 Include http_compat.h in http.c so we do not get warnings about functions with no prototypes. svn:r981
Niels Provos 17bfc07e 2008-12-23T22:38:01 remove http_compat include svn:r976
Niels Provos 02b2b4d1 2008-12-23T16:37:01 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
Niels Provos 97cebce8 2008-12-23T14:53:55 the switch of bufferevents for http connections did not handle the EVBUFFER_ERROR case correctly svn:r971
Niels Provos f1728d94 2008-12-19T22:41:07 fix the close detection problem correctly by not running close detection on the server svn:r968
Niels Provos f700566c 2008-12-19T21:31:43 Make the http connection close detection work properly with bufferevents and fix a potential memory leak associated with it svn:r963
Niels Provos 5792d42f 2008-11-16T23:22:14 Allow setting of local port for evhttp connections to support millions of connections from a single system; from Richard Jones svn:r948
Niels Provos 50202d75 2008-11-15T05:27:23 only bind the socket on connect when a local address has been provided; reported by Ajejo Sanchez svn:r946
Niels Provos b3d6a569 2008-09-07T23:24:54 do not remove accept-encoding header in make request svn:r938
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 c968eb3e 2008-08-19T11:26:47 Fix a bug where headers arriving in multiple packets were not parsed; fix from Jiang Hong; test by me. svn:r928
Niels Provos b89a3de0 2008-07-25T05:22:28 do not warn on accept when errno is egain|eintr svn:r925
Niels Provos f7e61870 2008-07-11T15:49:04 support multiple events listening on the same signal; make signals regular events that go on the same event queue svn:r901
Niels Provos df97fca9 2008-07-02T06:08:16 From Scott Lamb: * Allow the user to set the Content-Length: then stream a reply. This is useful for large requests of a known size. Added unit test. * Don't send a response body on HEAD requests, 1xx status codes, 204 status codes, or 304 status codes, as described in RFC 2616 section 4.3. (Doing otherwise causes problems - in particular, if a 304 has a chunked body (even an empty one), Safari 3.1.1 issues and then fails the next request on the connection with the non-sequitur error message "Too many HTTP redirects"!) * Specify a default Content-Type: when a response body is required, not when we have data in the response buffer by the time we make the header. (I.e., do this on evhttp_send_reply_start() for consistency.) * Don't expect a body in response to HEAD requests. svn:r898
Niels Provos 707f6784 2008-07-02T04:22:48 reject negative content-length headers svn:r894
Niels Provos cb7c3bd6 2008-06-29T01:30:06 support multi-line http headers; based on a patch from Moshe Litvin svn:r890
Niels Provos 9998c0cb 2008-06-26T00:40:57 correct handling of trailing headers in chunked replies; from Scott Lamb. svn:r887
Niels Provos c3dc717a 2008-06-24T23:37:37 close fd if evhttp_get_requestion_connection fails svn:r867
Niels Provos 24580e2b 2008-06-24T22:43:19 fix build on unix side svn:r866
Niels Provos 30abfd99 2008-06-24T22:38:37 provide fake_getnameinfo so that the http layer works under windows. svn:r864
Niels Provos 4c56ba1c 2008-06-20T06:52:13 do not use SO_REUSEADDR when connecting svn:r854
Niels Provos 774d056c 2008-06-17T01:14:58 warn on connection failures svn:r853
Niels Provos 344c2b56 2008-06-02T05:45:26 deliver partial data to request callbacks when chunked callback is set even if there is no chunking on the http level; allows cancelation of requests from within the chunked callback; from Scott Lamb. svn:r846
Niels Provos ec3956ba 2008-05-15T01:53:48 fix connection keep-alive behavior for HTTP/1.0 svn:r822
Niels Provos 1bce6f74 2008-05-13T03:51:10 use evhttp_connection_base_new() svn:r816
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
Niels Provos 1080852e 2008-05-12T03:12:09 allow cancelation of user initiated http requests; this will allow cancelation of rpc requests eventually svn:r812
Nick Mathewson 054159f5 2008-05-12T00:56:19 r19679@catbus: nickm | 2008-05-11 20:56:12 -0400 Windows does not have alloca(). svn:r810
Nick Mathewson 6bf1ca78 2008-05-12T00:40:04 r19675@catbus: nickm | 2008-05-11 20:39:39 -0400 Stop pretending that u_char and u_short are standard types that win32 is dumb not to have. In fact, u_char can really just be spelled out, and u_short was usually just a bad way of saying ev_uint16_t. svn:r808
Niels Provos a57767fa 2008-05-11T16:22:35 more accessors for evhttp_request svn:r807
Niels Provos 687be124 2008-05-10T07:32:05 dispatch the callbacks against the decoded uri to be more http compliant svn:r806
Niels Provos 7bbe185b 2008-05-10T06:32:53 evhttp_request_uri -> evhttp_request_get_uri svn:r805
Niels Provos 950af186 2008-05-10T05:58:17 replace fnmatch with homegrown function svn:r804
Nick Mathewson 8acb80b4 2008-05-08T22:51:39 r15551@tombo: nickm | 2008-05-08 14:49:20 -0400 Use _get_ convention for new accessor functions. (These are all new ones as of 2.0, I believe). svn:r799