Commit Graph

61 Commits

Author SHA1 Message Date
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
Aman Gupta
cae8a96c16 Fix build issues using mingw32 on windows 2010-11-10 21:58:55 -08:00
Ewen Cheslack-Postava
24be793f64 Provide typedefs instead of using stdint.h on Windows. 2010-11-04 20:36:14 -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
Ryan Dahl
a59ba4d866 Support long messages 2010-07-26 14:59:39 -07: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
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
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
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
Cliff Frey
076fa15132 reduce the size of the http_parser struct
The *_mark members were actually being used as just boolean values to
the next call of the parser.  However, you can calculate if the mark
members should be set or not purely based on the current state, so
they can just be gotten rid of entirely.
2010-05-28 12:41:27 -07:00
Cliff Frey
5502cddd35 reduce http_parser from 60 bytes to 48 bytes
This is mostly done by using sized types instead of enums, and
reordering fields to allow better packing.

I also moved the 'upgrade' field out of the PRIVATE section and into
the READ-ONLY section, as I believe that it is supposed to be
non-private.
2010-05-28 01:07:12 -07:00
Cliff Frey
0e8ad4e003 reduce size of http_parser object from 104 to 84 bytes by only tracking one field size
This does have some slight functional changes in cases where
MAX_FIELD_SIZE is hit, specficially if a URL is made up of many
components, each of which is smaller than MAX_FIELD_SIZE, but the
total together is greater than MAX_FIELD_SIZE, then we now might not
call callbacks for any of the components (even the ones that are
smaller than 80kb).  With the old code, it was possible to get a
callback for query_string and never get a callback for the URL (or at
least the end of the URL that is past 80kb), if the callback for the
URL would have been larger than 80kb.

(to be honest, I'm surprised that the MAX_FIELD_SIZE is implemented in
http_parser at all, instead of requiring that callers pay attention to
it, as it feels like it should be the caller's responsibility)
2010-05-28 01:02:16 -07:00
Cliff Frey
b8c3336f5d add support for HTTP_BOTH
This is good for analyzing raw streams of data when one is not sure
which direction it will be in.
2010-05-27 00:40:44 -07:00
Ryan Dahl
c2acc213ac Skip body for HEAD responses
TODO: need test for response with non-zero content length but no body.
2010-05-25 16:35:22 -07:00
Cliff Frey
7239788205 pass pointer to settings structure rather than pass by value 2010-05-11 12:12:23 -07:00
Ryan Dahl
88d11b394d Support Upgrade header 2010-04-14 03:17:11 -07:00
Ryan Dahl
6f72c780f0 Remove stddef include, it's included in http_parser.c 2010-03-13 20:55:55 -08:00
Ryan Dahl
e07e0b952e Tasteful vertical whitespace. 2010-02-27 21:24:09 -08:00
Ryan Dahl
dbd2dad461 Introduce http_parser_settings 2010-02-27 20:31:05 -08:00
Ryan Dahl
d37a9c5b9b fix typos 2010-02-22 08:11:01 -08:00
Ryan Dahl
1b30bf4ba5 Only allow 80kb of header bytes 2010-02-02 16:41:45 -08:00
Ryan Dahl
caef58793e Update license for 2010 2010-01-08 21:42:02 -08:00
Ryan Dahl
1a677040c0 API: Define parser type in http_parser_init()
That is, for a request parser do this:

  http_parser_init(my_parser, HTTP_REQUEST)

for a response parser do this:

  http_parser_init(my_parser, HTTP_RESPONSE)

Then http_parse_requests() and http_parse_responses() both turn
into http_parer_execute().
2010-01-08 21:38:17 -08:00
Ryan Dahl
1d9ebac036 Revert "Add method -> string lookup"
This reverts commit b795f94686.

(I don't like this feature, and I'm not using it.)
2010-01-06 19:03:32 -08:00
Ryan Dahl
79947a7334 Remove EOL whitespace 2010-01-06 18:54:51 -08:00
Ryan Dahl
b795f94686 Add method -> string lookup 2009-12-07 15:17:49 +01:00
Ryan Dahl
4aebd8bbb9 reorder methods 2009-12-07 00:15:22 +01:00
Ryan Dahl
9c059ec60d Reimplement support for extension methods
This sacrifices
- a little space (10 bytes),
- a few extra calculations, and
- introduces a dependency on strncmp()
to dramatically simplify the code of parsing methods and support almost
arbitrary extension methods.

In the future I will do as NGINX does and not use strncmp but bit level
blob comparisons.
2009-12-06 23:38:27 +01:00
Ryan Dahl
12808fe1e6 accept webdav methods 2009-12-06 19:13:17 +01:00
Ryan Dahl
bd291ab5d8 add license file 2009-11-20 15:59:31 +01:00
Ryan Dahl
5b00b6a64f add http_should_keep_alive() 2009-11-20 15:59:31 +01:00
Ryan Dahl
ca1e011ab3 add response scan, fix persistent bug 2009-11-20 15:59:30 +01:00
Ryan Dahl
fb6dc67b05 strict check 2009-11-20 15:59:30 +01:00
Ryan Dahl
0642366f0e change around api 2009-11-20 15:59:30 +01:00
Ryan Dahl
b283cd950f copyright header 2009-11-20 15:59:30 +01:00
Ryan Dahl
3834853a8a uri -> url 2009-11-20 15:59:30 +01:00
Ryan Dahl
0b8a48049c Handling chunked messages 2009-11-20 15:59:29 +01:00
Ryan Dahl
c5a92f792f Now parsing some req headers 2009-11-20 15:59:29 +01:00
Ryan Dahl
433202d825 new version
Trashing the old Ragel parser (which was based on Mongrel) because it's
proving difficult to get the control I need in end-of-message cases.
Replacing this with a hand written parser using a couple tricks borrowed
from NGINX. The new parser will be much more work to write, but should prove
faster and allow for better hacking.
2009-11-20 15:56:22 +01:00
Ryan Dahl
2769741ba5 Fix LICENSE 2009-11-14 14:46:10 +01:00
Ryan Dahl
ce381895aa Use enums instead of defines (for better debugging symbols) 2009-10-27 13:50:54 +01:00
Ryan
dbbc73c16f API Change: Return void from http_parser_execute(). 2009-08-22 14:30:30 +02:00
Ryan
efd801f410 Bug Fix: Connection:close with missing Content-Length.
The test and bug report are from tomika.
2009-08-22 14:27:58 +02:00
Ryan
f3214f9764 Move transfer encoding into flags bitfield. 2009-08-21 01:49:57 +02:00
Ryan
e65dcfbcf2 Use bit flags 2009-08-20 23:16:18 +02:00
Ryan
a7b96d81f1 API Change: parser->version_major/minor replaced with parser->version.
Allows for simpler processing.
2009-08-20 13:57:36 +02:00
Ryan
59a37f6600 Inline http_parser_should_keep_alive(). 2009-08-20 13:32:31 +02:00