153 Commits

Author SHA1 Message Date
Niels Provos
5c70ea4c9d improved code for evbuffer; avoids memcpy
svn:r674
2008-02-28 02:47:43 +00:00
Nick Mathewson
e7ad549390 r14507@tombo: nickm | 2008-02-26 15:23:44 -0500
Patch from Tani Hosokawa: make some functions in http.c threadsafe.  Also, note some functions in http.c that still are not threadsafe.


svn:r671
2008-02-26 20:24:29 +00:00
Niels Provos
7470ce52c5 increase listen queue for http sockets to 128
svn:r669
2008-02-26 03:49:00 +00:00
Niels Provos
960be58869 deal correctly with http/1.0 and keep-alive
svn:r667
2008-02-26 03:29:36 +00:00
Niels Provos
0b114da2b6 introduce evhttp_accept_socket() to accept from an already created socket
svn:r666
2008-02-26 03:12:07 +00:00
Niels Provos
b14cd655d1 add support (without tests!) to PUT/DELETE requests; from Josh Rotenberg
svn:r662
2008-02-25 07:49:22 +00:00
Nick Mathewson
d47907a730 r14213@tombo: nickm | 2008-02-16 15:48:07 -0500
Patch from Scott Lamb: make http content length into a 64-bit value.


svn:r641
2008-02-16 20:50:02 +00:00
Nick Mathewson
677a95864b r14205@tombo: nickm | 2008-02-16 11:55:57 -0500
Fix bug 1894184: add a CRLF after each chunk when sending chunked HTTP data.  Original patch from propanbutan.


svn:r637
2008-02-16 16:56:34 +00:00
Niels Provos
2fde221759 address some compiler warnings in debug mode
svn:r630
2008-02-09 16:03:01 +00:00
Niels Provos
955c6abf53 pausing an rpc via a hook needs to deal with the fact that http callbacks free the request after they return; provide a way for a callback to take ownership of the request structure; the user then needs to explicitly free it.
svn:r620
2007-12-28 00:36:47 +00:00
Niels Provos
fdafb66bb5 removed linger from http server socket; reported by Ilya Martynov
svn:r604
2007-12-19 06:33:05 +00:00
Nick Mathewson
77861fa7f1 r16931@catbus: nickm | 2007-12-06 14:19:58 -0500
Fix warnings in debug messages


svn:r577
2007-12-06 19:20:24 +00:00
Nick Mathewson
3206bbca46 r15171@tombo: nickm | 2007-12-06 12:47:47 -0500
Use GCC attributes (where available) to verify printf type-correctness.  Fix some bugs this turned up.


svn:r573
2007-12-06 18:12:56 +00:00
Nick Mathewson
5482192bb3 r15166@tombo: nickm | 2007-12-05 23:35:10 -0500
Apply patch from bug 1841036: set the base of the correct event in evhttp_connection_start_detectclose()


svn:r571
2007-12-06 04:36:18 +00:00
Niels Provos
74b3db50ae always generate Date and Content-Length headers for HTTP/1.1
svn:r564
2007-11-29 06:08:24 +00:00
Nick Mathewson
a7a7a19045 r16735@catbus: nickm | 2007-11-26 14:24:58 -0500
Fix test for EVBUFFER_LENGTH in evhttp_make_header().  Since appending an empty buffer to another is a no-op, this is not really a bug-fix.


svn:r554
2007-11-26 19:25:09 +00:00
Nick Mathewson
ce4ee418d2 r16733@catbus: nickm | 2007-11-26 14:18:25 -0500
Add an --enable-gcc-warnings option (lifted from Tor) to the configure script.  When provided, and when we are using GCC, we enable a bunch of extra GCC warnings in the compiler.  Also, make the code all build happily with these warnings.


svn:r553
2007-11-26 19:18:49 +00:00
Nick Mathewson
1120f04f3e 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
2007-11-25 21:53:06 +00:00
Nick Mathewson
6773a59721 r14953@tombo: nickm | 2007-11-25 15:56:40 -0500
Replace evbuffer_readline with a more powerful evbuffer_readln that can handle more EOL styles, and that can give useful results when there are NUL characters inside the returned values. Includes regression tests.


svn:r550
2007-11-25 21:32:26 +00:00
Nick Mathewson
7eb250e9c5 r14939@tombo: nickm | 2007-11-25 11:59:26 -0500
New function event_set_mem_functions to replace internal calls to malloc, free, etc with a user-supplied functions.


svn:r541
2007-11-25 17:14:19 +00:00
Nick Mathewson
4e1ec3e05e Make all the C files in the libraries compile under MSVC 2005 Express. There are still a few warnings, and probably some subtle issues, but it's better than nothing.
svn:r499
2007-11-07 21:01:26 +00:00
Nick Mathewson
e72661d2ff r16509@catbus: nickm | 2007-11-07 02:08:32 -0500
Stop using C++ style comments.


svn:r497
2007-11-07 07:33:31 +00:00
Nick Mathewson
1f50f41283 r16508@catbus: nickm | 2007-11-07 02:01:03 -0500
Note a dubious point in http.c


svn:r496
2007-11-07 07:33:26 +00:00
Nick Mathewson
7feba57010 r16507@catbus: nickm | 2007-11-07 01:34:55 -0500
Never assign a string constant to a non-const char *.


svn:r495
2007-11-07 07:33:21 +00:00
Nick Mathewson
a3f122d667 r16506@catbus: nickm | 2007-11-07 01:29:59 -0500
Make all rpc and http functions not prototyped in evrpc.h and evhttp.h into static functions.  I believe that these functions were meant to be private, yes?


svn:r494
2007-11-07 07:33:16 +00:00
Nick Mathewson
f74e7258fd r16501@catbus: nickm | 2007-11-07 01:00:31 -0500
This is one of those patches which will either make matters far
 simpler after the bugs shake out, or will get reverted pretty quick
 once we realize that it is a stupid idea.
 
 We now post-process the config.h file into a new event-config.h file,
 whose macros are prefixed with _EVENT_ and which is thus safe for
 headers to include.  Using this, we can define replacement timeval
 manipulation functions in evutil.h, and use them uniformly through our
 code.  We can also detect which headers are needful in event.h, and
 include them as required.
 
 This is also the perfect time to remove the long-deprecated acconfig.h
 file, so that autoheader no longer warns.
 
 Should resolve the following issues:
 
 [ 1826530 ] Header files should have access to autoconf output.
 [ 1826545 ] acconfig.h is deprecated.
 [ 1826564 ] On some platforms, event.h can't be included alone.
 


svn:r492
2007-11-07 06:01:57 +00:00
Niels Provos
2026b21598 remove last vestiges of RBTREE
svn:r470
2007-11-03 23:53:49 +00:00
Nick Mathewson
49ede3be00 r15517@catbus: nickm | 2007-10-03 13:14:05 -0400
Correct the pointer manipulation in fake_getaddrinfo(), and do the right thing for fake_getaddrinfo(NULL,&ai).  Based on a patch by Lubmir Marinov, hacked until the unit tests passed on Linux with #undef HAVE_GETADDRINFO.


svn:r459
2007-10-03 17:19:22 +00:00
Nick Mathewson
bc7b7c249c Fix implementation of strsep.
svn:r457
2007-10-03 04:14:54 +00:00
Nick Mathewson
fe4829776b 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
2007-09-24 16:26:11 +00:00
Nick Mathewson
d85bce4e96 Remove gratuitous tor-isms in evutil_socketpair(); fix a windows warning in http.c.
svn:r446
2007-09-20 18:38:31 +00:00
Nick Mathewson
8b256b8e86 r15218@catbus: nickm | 2007-09-20 14:14:05 -0400
More win32 fixes: Use evutil_make_socket_nonblocking and EVUTIL_CLOSESOCKET consistently throughout the code.


svn:r443
2007-09-20 18:26:51 +00:00
Niels Provos
b835ee085f fix http.c to compile properly with USE_DEBUG; from Christopher Layne
svn:r430
2007-09-15 15:50:11 +00:00
Niels Provos
e2f564116e Fix a memory leak in which failed HTTP connections whould not free the request object
svn:r419
2007-09-09 02:33:10 +00:00
Niels Provos
98f9616bf4 support setting local address on an evhttp_connection
svn:r416
2007-09-07 02:49:46 +00:00
Nick Mathewson
23866b7657 Another tweak on the date patch: win32 has no gmtime_r, but its gmtime() function uses thread-local storage for safety. Backportable.
svn:r414
2007-09-07 01:18:53 +00:00
Nick Mathewson
003698c0df r14975@catbus: nickm | 2007-09-06 21:00:38 -0400
Oops; we were already including sys/time.h.  Remove the redundant include.


svn:r413
2007-09-07 01:03:01 +00:00
Nick Mathewson
8d5ef326ba r14974@catbus: nickm | 2007-09-06 20:59:14 -0400
Changes to http.c: Add a Date header on replies if there is none already set.  Also, include time.h unconditionally to be sure that struct tm is declared: every platform has time.h; the conditional should have been for sys/time.h.


svn:r412
2007-09-07 01:02:56 +00:00
Niels Provos
ff9e1af68f demote most warnings to debug messages;
execute callback later to allow freeing of connection object


svn:r407
2007-09-02 01:33:38 +00:00
Niels Provos
11a0a9e42f allow \r or \n individually to separate HTTP headers instead of
the standard "\r\n"; from Charles Kerr.


svn:r406
2007-08-25 18:47:22 +00:00
Niels Provos
67947ce381 provide evhttp_new and evhttp_bind_socket instead of evhttp_start;
using evhttp_new, it is possible to associate an event_base with
the http server so that multi-threaded applications can have their
own http server per thread; add appropriate testing.


svn:r397
2007-08-19 02:41:23 +00:00
Niels Provos
cd6dd9516d add a proper test for filtering new lines in headers
svn:r384
2007-08-06 21:00:49 +00:00
Niels Provos
073d359061 fix an embarassing bug where strchr was used with a cstring instead of a char
svn:r383
2007-08-06 20:53:33 +00:00
Niels Provos
8ea5ffefc3 request dispatching fix from Elliot Foster
svn:r382
2007-08-05 02:15:10 +00:00
Niels Provos
b7ff0248c7 fix memory leak; found by Elliot F
svn:r378
2007-07-31 00:32:00 +00:00
Niels Provos
3ad6b47e03 make clock_monotonic work; do not use default timeout;
from Scott Lamb, plus some fixes from me.


svn:r371
2007-07-30 22:41:00 +00:00
Niels Provos
d7918e7963 drop illegal header values
svn:r370
2007-07-30 21:27:33 +00:00
Niels Provos
f0ff792afa fixes from Joerg Sonnenberger:
http.c is a violation of the ctype(3) interface and an unused function.

test/regress_http.c are incorrect format strings.

test/regress.c uses raise(3) from signal.h.

evdns.c: evdns_error_strings is unused. The GET* macros can eat the
semicolon from the expression. pos is passed in as off_t, so just pass
that down. When assigning negativ values to unsigned variables, an
explicit cast is considered good style.


svn:r367
2007-06-30 18:58:34 +00:00
Niels Provos
aa5c806888 make it compile on solaris; from Andrei Nigmatulin
svn:r366
2007-06-16 03:23:15 +00:00
Niels Provos
cf5c1fcebb made the wrong fd non-blocking in accept_socket; from szjwwu
svn:r364
2007-06-08 16:06:23 +00:00