58 Commits

Author SHA1 Message Date
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
ac0c7e2c7d skip connection-retry test on windows
svn:r869
2008-06-25 00:58:08 +00:00
Niels Provos
f80f90ed8b fix a bug in http_connect for windows; the address was not copied correctly.
svn:r863
2008-06-24 21:01:44 +00:00
Niels Provos
994a7c50e1 close -> EVUTIL_CLOSESOCKET()
gettimeofday -> evutil_gettimeofday()

svn:r861
2008-06-24 16:39:45 +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
89a1512a74 close -> EVUTIL_CLOSESOCKET
svn:r832
2008-05-15 06:33:23 +00:00
Nick Mathewson
0cafdeb6f5 Tweaks to make unit tests fail less badly on mingw on trunk.
svn:r814
2008-05-12 17:16:47 +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
Niels Provos
950af18679 replace fnmatch with homegrown function
svn:r804
2008-05-10 05:58:17 +00:00
Nick Mathewson
f2d65f8a9c r19634@catbus: nickm | 2008-05-07 16:10:37 -0400
the C syntax is fn(void), not fn().


svn:r784
2008-05-07 20:29:33 +00:00
Niels Provos
300a4efb2d test virtual hosts
svn:r780
2008-05-07 01:52:24 +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
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
0ec09b5507 also try client connection for chunked requests
svn:r741
2008-04-29 04:35:26 +00:00
Niels Provos
9c480533bf test the server side of sending chunked replies
svn:r740
2008-04-29 02:33:27 +00:00
Niels Provos
72a3902e5c test some primitives from http.c
svn:r739
2008-04-29 00:24:00 +00:00
Niels Provos
22c8a40402 test connection retry logic
svn:r736
2008-04-27 20:04:33 +00:00
Niels Provos
7b29ad57d9 test server behavior when connection times out while reading the headers
svn:r735
2008-04-27 19:41:26 +00:00
Niels Provos
eb9b958089 add some basic tests for DELETE/PUT; from Josh Rotenberg
svn:r673
2008-02-27 06:20:48 +00:00
Niels Provos
024804cce7 the win32 changes for regress_http broke the regression test under unix. making the socket non-blocking can return -1 on connect; so now, we need to check the errno; not sure if that is supported under windows.
svn:r621
2007-12-28 07:58:29 +00:00
Nick Mathewson
6d291da240 Fix at least two bugs that are keeping the HTTP regression tests from running on windows. There are some more bugs somewhere, since the HTTP regression tests still fail on windows. But now they fail less.
svn:r619
2007-12-28 00:34:05 +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
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
1e1f77c5b0 Make the test/ subdirectory buildable under Windows. Well, mingw at least. The tests still don't all pass, but at least now we know that.
svn:r447
2007-09-20 19:08:20 +00:00
Niels Provos
e678f009a8 fix a couple memory leaks; time buffer marshaling
svn:r417
2007-09-09 01:46:35 +00:00
Niels Provos
98f9616bf4 support setting local address on an evhttp_connection
svn:r416
2007-09-07 02:49:46 +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
Nick Mathewson
35983cd60f r14618@catbus: nickm | 2007-08-16 17:11:47 -0400
In ANSI C, int func() is a function with unspecified arguments, whereas int func(void) is a function that takes no arguments.  Using int func() to mean a function with no arguments is a C++ism, so let's not use or generate it.


svn:r395
2007-08-16 21:12:53 +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
72c479e76a remove c99 variable declarations; from Jan Kneschke
svn:r374
2007-07-30 23:54:25 +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
b5d2f9a255 rolling back r339: evconfig.h does not work
svn:r341
2007-03-01 06:25:18 +00:00
Niels Provos
127c260bb7 make evconfig.h available as installed header file; not
really ideal but good enough for me; from Nick Mathewson


svn:r339
2007-02-28 04:02:29 +00:00
Niels Provos
d5d04949e3 fix http server so it can accept on high ports;
better warning messages for getnameinfo;
from Philip Lewis


svn:r310
2007-01-18 06:28:42 +00:00
Niels Provos
0db257b828 rename strlcpy so that it does not conflict with other tests; from
Nick Mathewson.


svn:r306
2007-01-03 07:11:17 +00:00
Niels Provos
942656bb5c persistent connections are somewhat complicated; detect on the client side if the
server closes a persistent connection.  previously, we would have failed the next
request on that connection.  provide test case.


svn:r277
2006-11-23 06:32:20 +00:00
Niels Provos
31ba30abfe make regression test work for poll and select
svn:r265
2006-11-18 08:51:12 +00:00
Niels Provos
9d81ac48f8 test both piplining on persistent and non-persistent connections
svn:r262
2006-11-18 03:43:26 +00:00
Niels Provos
36212f9df0 make persistent connections work; needs more testing
svn:r261
2006-11-18 03:05:26 +00:00
Niels Provos
a67d9cb115 add "Connection: close" to the output headers of the HTTP server reply;
we don't currently support persistent connections; although that's going
to be easy to add.


svn:r259
2006-11-17 07:45:42 +00:00
Niels Provos
c4836d1053 make sure that the rpc callback receives an unmarshaled payload;
make sure that the rpc reply contains a good rpc structure, too.


svn:r258
2006-11-17 06:06:17 +00:00
Niels Provos
f554234f74 first stab at an rpc layer; this breaks the regression test.
svn:r254
2006-11-16 07:36:20 +00:00
Niels Provos
3eec7f7c64 make it 1.2; fix some size issues for printf in regression code
svn:r242
2006-10-15 21:55:13 +00:00