about summary refs log tree commit homepage
path: root/ext/http11/http11_parser.rl
diff options
context:
space:
mode:
authornormalperson <normalperson@19e92222-5c0b-0410-8929-a290d50e31e9>2008-07-15 00:34:03 +0000
committernormalperson <normalperson@19e92222-5c0b-0410-8929-a290d50e31e9>2008-07-15 00:34:03 +0000
commitcf6be9bdf2eb77884770e878b58a47f8265aa647 (patch)
tree4e7b9b9d845e9b6c2274f56dab3f4c9b4aece69a /ext/http11/http11_parser.rl
parent09f3d0601450aa89f32576d7a628a9e27ee73a83 (diff)
downloadunicorn-cf6be9bdf2eb77884770e878b58a47f8265aa647.tar.gz
The main thing is to not update the parser current state (cs) if
we have an error.  The other changes were to revert mistakes
in an attempt at Ragel 6.2 compatibility.

git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@1029 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'ext/http11/http11_parser.rl')
-rw-r--r--ext/http11/http11_parser.rl7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/http11/http11_parser.rl b/ext/http11/http11_parser.rl
index 5e551a3..c3c4b1f 100644
--- a/ext/http11/http11_parser.rl
+++ b/ext/http11/http11_parser.rl
@@ -114,12 +114,13 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len,
   p = buffer+off;
   pe = buffer+len;
 
-  /* assert(*pe == '\0' && "pointer does not end on NUL"); */
+  assert(*pe == '\0' && "pointer does not end on NUL");
   assert(pe - p == len - off && "pointers aren't same distance");
 
   %% write exec;
 
-  parser->cs = cs;
+  if (!http_parser_has_error(parser))
+    parser->cs = cs;
   parser->nread += p - (buffer + off);
 
   assert(p <= pe && "buffer overflow after parsing execute");
@@ -148,5 +149,5 @@ int http_parser_has_error(http_parser *parser) {
 }
 
 int http_parser_is_finished(http_parser *parser) {
-  return parser->cs >= http_parser_first_final;
+  return parser->cs == http_parser_first_final;
 }