Commit Graph

174 Commits

Author SHA1 Message Date
Ryan Dahl
ff762c2c9b improve execute2 doc 2011-01-19 12:35:59 -08:00
Ryan Dahl
c95a547959 event stream 2010-12-05 17:54:43 -08:00
Nathan Rajlich
f825b52b7f Added support for "SUBSCRIBE" and "UNSUBSCRIBE" request methods. 2010-11-21 21:37:57 -08:00
Nathan Rajlich
d56a0700d0 Add support for "M-SEARCH" and "NOTIFY" request methods.
Allow a request path of "*" (for SSDP requests).
2010-11-21 21:37:57 -08:00
Ryan Dahl
03970a576d Test that it can handle $ in header field 2010-11-10 22:09:03 -08:00
Nathan Rajlich
84578ae7a8 Set http_major when a request omits the HTTP version
I.E. "GET /" in telnet
2010-11-10 22:04:35 -08:00
Aman Gupta
cae8a96c16 Fix build issues using mingw32 on windows 2010-11-10 21:58:55 -08:00
Ryan Dahl
b75cea580a Test for dots at the begging on header fields 2010-11-10 21:52:24 -08:00
Ryan Dahl
04bc364610 Make sure it can handle spaces in content-length 2010-11-10 21:48:14 -08:00
Ryan Dahl
37e9009369 Digits in hostname on CONNECT req allowed 2010-11-10 21:42:00 -08:00
Cliff Frey
90320fde7a Remove acceptable_header array
This was not necessary, as it was just being used as a downcase
function.
2010-11-10 21:34:51 -08:00
Ryan Dahl
fb875caa43 Add non-ascii in status line test
from Ben Noordhuis
2010-11-05 15:42:06 -07:00
Ryan Dahl
51de89f8b0 Accept tokens + SP for header fields 2010-11-05 15:25:54 -07:00
Ewen Cheslack-Postava
24be793f64 Provide typedefs instead of using stdint.h on Windows. 2010-11-04 20:36:14 -07:00
Ryan Dahl
047ced3784 readme typo (thanks tmm1) 2010-10-20 09:50:41 -07:00
Nathan Rajlich
a66c61c190 Allow whitespace in the 'Content-Length' header. 2010-10-12 09:29:10 -07:00
Cliff Frey
459507f534 avoid assertion failure in error case
Without this change, it is possible to get an assertion to fail by
continuing to call http_parser_execute after it has returned an error.
Specifically, the parser could be called with parser->state ==
s_chunk_size_almost_done and parser->flags & F_CHUNKED set.  Then,
F_CHUNKED could have been cleared, and an error could be hit.  In this
case, the parser would have returned with F_CHUNKED clear, but
parser->state == s_chunk_size_almost_done, resulting in an assertion
failure on the next call.

There are alternate solutions possible, including just saving all of
the fields (state included) on error.

I didn't add a test case because this is a bit annoying to test, but I
can add one if necesssary.
2010-09-11 18:32:43 -07:00
Ben Noordhuis
cbb194ea8c Replace C++ style comments with C comments so it compiles with gcc -ansi -Wall 2010-08-27 05:36:16 -07:00
Cliff Frey
c30ea4515c save 8 bytes in http_parser structure
nread can never be larger than HTTP_MAX_HEADER_SIZE
2010-08-18 11:07:14 -07:00
Cliff Frey
ca2514dd3a Array type cleanups. Also save space
acceptable_header[x] is always assigned to a variable of type char, so
the 'unsigned' is unnecessary.

The other arrays can be of type int8_t/uint8_t to save space.
2010-08-18 11:06:51 -07:00
Cliff Frey
423c90d9fe fixes for architectures with signed char default
This could have resulted in memory before the normal_url_char array
being read on architectures with signed char default.
2010-08-18 11:06:47 -07:00
Ryan Dahl
c1d48fdce8 Changes to compile with clang 2010-07-31 14:31:29 -07:00
Ryan Dahl
6f12467a8a Use lookup tables of my own. 2010-07-31 14:27:58 -07:00
Jeff Terrace
d0dfc98773 Initialize method member to avoid falsely upgrading connections. Fixed Issue #7 2010-07-30 11:06:31 -07:00
Ryan Dahl
d6f34ae992 Add CONTRIBUTIONS file 2010-07-30 11:02:34 -07:00
Ryan Dahl
f0d50c3fb1 Update size of struct in README 2010-07-30 11:00:47 -07:00
Ryan Dahl
c7c242d55c typo 2010-07-26 15:00:12 -07:00
Ryan Dahl
a59ba4d866 Support long messages 2010-07-26 14:59:39 -07:00
Ryan Dahl
120f0f6e09 Allow spaces in header fields 2010-07-24 16:37:27 -07:00
Ryan Dahl
5f27ea8179 Fix long line 2010-07-24 16:27:32 -07:00
Tim Becker
8c3101cbe2 redundant upgrade flag check 2010-07-18 22:50:19 -07:00
Santiago Gala
0264a0aefc Upgrade on CONNECT method 2010-07-17 01:20:48 -07:00
Cliff Frey
c83a018d05 test: always try and break every testcase up into two submessages
This is just another way that would have caught the bug introduced in
076fa15132 and fixed by
03b8eaa5f8.
2010-07-07 00:42:06 +02:00
Cliff Frey
deaee07c86 fix http_parser_init to initialize flags correctly
Yay valgrind testing

I don't believe that this actually mattered at all, because state was
initialized correctly, and flags would be set to 0 almost immediately
anyways.
2010-07-07 00:41:39 +02:00
Cliff Frey
5dd740304f test.c: get it to work with valgrind by using realloc less
For some reason valgrind would rapidly run out of memory on my machine
without this.
2010-07-07 00:41:01 +02:00
Ryan Dahl
c46b3e3942 Fix typo s_start_res_or_resp 2010-07-06 16:35:48 +02:00
Ryan Dahl
03b8eaa5f8 Reset url_mark on s_req_host
add a new scan test. Report and fix by Master Becker.
2010-07-06 12:00:52 +02:00
Ewen Cheslack-Postava
4afe80a44e Add definitions and typedefs to support compilation in Visual Studio under C++ mode. 2010-06-28 00:14:25 -07:00
Ryan Dahl
ddbd5c3728 Expose http_method_str() to get a string version of a method 2010-06-23 21:04:57 -07:00
Ryan Dahl
9dc258f9dd Add subversion request methods
REPORT, MKACTIVITY, CHECKOUT, MERGE
2010-06-23 21:04:32 -07:00
Cliff Frey
6533f8ac9c do not access random memory before lowcase array
This matters because char is signed by default on x86, so bytes with
values above 127 could have theoretically survived a pass through
lowcase (assuming that there was some non-zero data before the lowcase
array).
2010-06-11 17:28:58 -07:00
Cliff Frey
9eac636531 save more space by removing buffer and shortening method
This also fixes test failures from the previous commit.

It also adds support for the LOCK method, which was previously
missing.

This brings the size of http_parser from 44 bytes to 32 bytes.  It
also makes the code substantially shorter, at a slight cost in
craziness.
2010-06-11 15:17:38 -07:00
Cliff Frey
7a1103ae53 add tests of method strings
Currently this test fails, because short method strings do not cause
failures, even if they are unknown methods.  However, long unknown
method strings do cause errors.
2010-06-11 15:17:28 -07:00
Cliff Frey
634c3a6d26 test: fix compile warnings about printf + size_t 2010-06-11 15:14:36 -07:00
Cliff Frey
546f43a782 remove body_read
This saves space in the structure (it is now 28 bytes on x86), and
makes the handling of content_length more consistent between chunked
encoding and non-chunked-encoding.
2010-06-11 11:15:06 -07:00
Cliff Frey
2d16d50425 only increment nread while looking at headers
This fixes a possible issue where a very large body (one that involves
> 80*1024 calls to http_parser_execute) will cause the next request
with that parser to return an error because it believes that this is
an overflow condition.
2010-06-11 10:58:42 -07:00
Cliff Frey
b413961182 test.c: add cases for header overflow conditions
This currently fails, but the next commit fixes the issue.
2010-06-11 09:54:37 -07:00
Ryan Dahl
4cf39fd2fa Support request URLs without schema
Test case from Poul T Lomholt <pt@lomholt.com>
2010-06-06 16:18:41 -07:00
Ryan Dahl
cdda8b6a60 Support empty header values
Test case by Pierre Ruyssen <pierre@ruyssen.fr>
2010-06-06 16:01:42 -07:00
Cliff Frey
8732d108a4 stop tracking lengths of returned values
This drops support for MAX_FIELD_SIZE, and saves 4 more bytes in the
parser object (44 bytes total now).
2010-05-28 12:42:12 -07:00