about summary refs log tree commit homepage
path: root/ext/unicorn/http11/http11_parser.h
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-03-24 02:35:26 -0700
committerEric Wong <normalperson@yhbt.net>2009-03-24 02:44:20 -0700
commit32b6e838c28b7948811a6470d8c0a49d5767ec69 (patch)
tree016c38119477d56a839be8afc8ee702446c02b6b /ext/unicorn/http11/http11_parser.h
parent7110a0dc380c53433e0b76496356abe7ccfa9021 (diff)
downloadunicorn-32b6e838c28b7948811a6470d8c0a49d5767ec69.tar.gz
This cuts the HttpParser interface down to #execute and #reset
method.  HttpParser#execute will return true if it completes and
false if it is not.  http->nread state is kept internally so we
don't have to keep track of it in Ruby; removing one parameter
from #execute.

HttpParser#reset is unchanged.

All errors are handled through exceptions anyways, so the
HttpParser#error? method stopped being useful.

Also added some more unit tests to the HttpParser since I know
some folks are (rightfully) uncomfortable with changing stable C
code.  We now have tests for incremental parsing.

In summary, we have:

  * more test cases
  * less C code
  * simpler interfaces
  * small performance improvement

  => win \o/
Diffstat (limited to 'ext/unicorn/http11/http11_parser.h')
-rw-r--r--ext/unicorn/http11/http11_parser.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/ext/unicorn/http11/http11_parser.h b/ext/unicorn/http11/http11_parser.h
index c96b3a0..6c332fe 100644
--- a/ext/unicorn/http11/http11_parser.h
+++ b/ext/unicorn/http11/http11_parser.h
@@ -36,10 +36,8 @@ typedef struct http_parser {
 
 int http_parser_init(http_parser *parser);
 int http_parser_finish(http_parser *parser);
-size_t http_parser_execute(http_parser *parser, const char *data, size_t len, size_t off);
+size_t http_parser_execute(http_parser *parser, const char *data, size_t len);
 int http_parser_has_error(http_parser *parser);
 int http_parser_is_finished(http_parser *parser);
 
-#define http_parser_nread(parser) (parser)->nread
-
 #endif