153 Commits

Author SHA1 Message Date
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
Niels Provos
c968eb3e01 Fix a bug where headers arriving in multiple packets were not parsed; fix from Jiang Hong; test by me.
svn:r928
2008-08-19 11:26:47 +00:00
Niels Provos
b89a3de044 do not warn on accept when errno is egain|eintr
svn:r925
2008-07-25 05:22:28 +00:00
Niels Provos
f7e61870e9 support multiple events listening on the same signal; make signals regular events that go on the same event queue
svn:r901
2008-07-11 15:49:04 +00:00
Niels Provos
df97fca9ca 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
2008-07-02 06:08:16 +00:00
Niels Provos
707f67849a reject negative content-length headers
svn:r894
2008-07-02 04:22:48 +00:00
Niels Provos
cb7c3bd671 support multi-line http headers; based on a patch from Moshe Litvin
svn:r890
2008-06-29 01:30:06 +00:00
Niels Provos
9998c0cbc8 correct handling of trailing headers in chunked replies; from Scott Lamb.
svn:r887
2008-06-26 00:40:57 +00:00
Niels Provos
c3dc717a38 close fd if evhttp_get_requestion_connection fails
svn:r867
2008-06-24 23:37:37 +00:00
Niels Provos
24580e2b58 fix build on unix side
svn:r866
2008-06-24 22:43:19 +00:00
Niels Provos
30abfd99a2 provide fake_getnameinfo so that the http layer works under windows.
svn:r864
2008-06-24 22:38:37 +00:00
Niels Provos
4c56ba1ced do not use SO_REUSEADDR when connecting
svn:r854
2008-06-20 06:52:13 +00:00
Niels Provos
774d056c46 warn on connection failures
svn:r853
2008-06-17 01:14:58 +00:00
Niels Provos
344c2b56f1 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
2008-06-02 05:45:26 +00:00
Niels Provos
ec3956ba48 fix connection keep-alive behavior for HTTP/1.0
svn:r822
2008-05-15 01:53:48 +00:00
Niels Provos
1bce6f7434 use evhttp_connection_base_new()
svn:r816
2008-05-13 03:51:10 +00:00
Nick Mathewson
c6da86ffcb 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
2008-05-12 16:44:24 +00:00
Niels Provos
1080852e91 allow cancelation of user initiated http requests; this will allow cancelation of rpc requests eventually
svn:r812
2008-05-12 03:12:09 +00:00
Nick Mathewson
054159f59c r19679@catbus: nickm | 2008-05-11 20:56:12 -0400
Windows does not have alloca().


svn:r810
2008-05-12 00:56:19 +00:00
Nick Mathewson
6bf1ca780c 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
2008-05-12 00:40:04 +00:00
Niels Provos
a57767faf8 more accessors for evhttp_request
svn:r807
2008-05-11 16:22:35 +00:00
Niels Provos
687be1241b dispatch the callbacks against the decoded uri to be more http compliant
svn:r806
2008-05-10 07:32:05 +00:00
Niels Provos
7bbe185b0e evhttp_request_uri -> evhttp_request_get_uri
svn:r805
2008-05-10 06:32:53 +00:00
Niels Provos
950af18679 replace fnmatch with homegrown function
svn:r804
2008-05-10 05:58:17 +00:00
Nick Mathewson
8acb80b4f9 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
2008-05-08 22:51:39 +00:00
Nick Mathewson
7defe4cbc1 r15549@tombo: nickm | 2008-05-08 11:53:11 -0400
Make new http headers include minimal parts of event2/ tree; make old evhttp.h incldue event.h, since the old one did too.


svn:r798
2008-05-08 15:55:09 +00:00
Niels Provos
de1c43926b migrate evhttp to event2; accessors are still missing
svn:r790
2008-05-08 06:15:04 +00:00
Nick Mathewson
891dba4376 r19597@catbus: nickm | 2008-05-05 11:00:29 -0400
define _GNU_SOURCE before including fnmatch.h so that FNM_CASEFOLD gets defined and linux build gets fixed.  This whole fnmatch() business will be a bit hard to port, though: windows doesn't have one IIUC, so we'll have to reimplement our own to work there.


svn:r772
2008-05-05 15:00:53 +00:00
Niels Provos
f2a81fbc67 add support for virtual http hosts; no tests yet
svn:r771
2008-05-05 07:17:05 +00:00
Niels Provos
f940eb4b8d fix a bug where it was not possible to bind multiple sockets to the same http
server; test that binding multiple sockets works.


svn:r769
2008-05-04 22:21:29 +00:00
Nick Mathewson
5fbc7f0aee r15439@tombo: nickm | 2008-05-02 12:28:08 -0400
use event_assign internall; switch uses of event_set to use event_assign instead.


svn:r755
2008-05-02 16:28:25 +00:00
Nick Mathewson
98dc98c59f r15346@tombo: nickm | 2008-04-29 17:19:18 -0400
Remove the never-exported, never-used, never-threadsafe evhttp_hostportfile()


svn:r746
2008-04-29 21:19:26 +00:00
Nick Mathewson
4cff82bb4f r15339@tombo: nickm | 2008-04-29 14:03:48 -0400
Note that evhttp_hostportfile is not threadsafe, and so its usage will change.  Mark its first argument const. Remove a now-redundant declaration for it in http-internal.h.


svn:r743
2008-04-29 18:11:10 +00:00
Niels Provos
e44ef375ee convert evhttp_connection to use bufferevents
svn:r742
2008-04-29 04:52:50 +00:00
Niels Provos
72a3902e5c test some primitives from http.c
svn:r739
2008-04-29 00:24:00 +00:00
Nick Mathewson
49868b618a r15316@tombo: nickm | 2008-04-24 20:58:36 -0400
Rename internal memory management functions from event_malloc() etc to mm_malloc() etc.


svn:r725
2008-04-25 01:18:08 +00:00
Nick Mathewson
a55a67d56e r15249@tombo: nickm | 2008-04-18 09:46:02 -0400
Avoid leaking a string in the unlikely OOM case from name_from_addr. spotted by niels.


svn:r724
2008-04-18 13:46:13 +00:00
Nick Mathewson
8863ff7625 r15224@tombo: nickm | 2008-04-17 15:19:24 -0400
Oops. We need to make sure that strdup wasn't oom.


svn:r718
2008-04-17 19:19:36 +00:00
Nick Mathewson
ae09ac4ae0 r15220@tombo: nickm | 2008-04-17 15:16:02 -0400
Use new includes in more files still


svn:r717
2008-04-17 19:18:40 +00:00
Nick Mathewson
fc41ffde4d r15214@tombo: nickm | 2008-04-17 11:47:10 -0400
Make name_from_addr() threadsafe in http.c


svn:r713
2008-04-17 15:50:28 +00:00
Niels Provos
558de9b377 Provide OpenSSL style support for multiple threads accessing the same event_base
svn:r684
2008-03-02 21:18:33 +00:00
Nick Mathewson
593b5f99b3 r18492@catbus: nickm | 2008-02-29 17:32:55 -0500
Add another missing _REENTRANT.


svn:r681
2008-02-29 22:33:01 +00:00