diff options
Diffstat (limited to 'ext/unicorn/http11/http11_parser.rl')
-rw-r--r-- | ext/unicorn/http11/http11_parser.rl | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/ext/unicorn/http11/http11_parser.rl b/ext/unicorn/http11/http11_parser.rl index 1fad2ca..a86e8cd 100644 --- a/ext/unicorn/http11/http11_parser.rl +++ b/ext/unicorn/http11/http11_parser.rl @@ -3,10 +3,8 @@ * You can redistribute it and/or modify it under the same terms as Ruby. */ #include "http11_parser.h" -#include <stdio.h> #include <assert.h> #include <stdlib.h> -#include <ctype.h> #include <string.h> /* @@ -28,7 +26,7 @@ static void snake_upcase_char(char *c) /** Machine **/ %%{ - + machine http_parser; action mark {MARK(mark, fpc); } @@ -36,36 +34,36 @@ static void snake_upcase_char(char *c) action start_field { MARK(field_start, fpc); } action snake_upcase_field { snake_upcase_char((char *)fpc); } - action write_field { + action write_field { parser->field_len = LEN(field_start, fpc); } action start_value { MARK(mark, fpc); } - action write_value { + action write_value { if(parser->http_field != NULL) { parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, fpc)); } } - action request_method { - if(parser->request_method != NULL) + action request_method { + if(parser->request_method != NULL) parser->request_method(parser->data, PTR_TO(mark), LEN(mark, fpc)); } - action request_uri { + action request_uri { if(parser->request_uri != NULL) parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, fpc)); } - action fragment { + action fragment { if(parser->fragment != NULL) parser->fragment(parser->data, PTR_TO(mark), LEN(mark, fpc)); } action start_query {MARK(query_start, fpc); } - action query_string { + action query_string { if(parser->query_string != NULL) parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, fpc)); } - action http_version { + action http_version { if(parser->http_version != NULL) parser->http_version(parser->data, PTR_TO(mark), LEN(mark, fpc)); } @@ -75,8 +73,8 @@ static void snake_upcase_char(char *c) parser->request_path(parser->data, PTR_TO(mark), LEN(mark,fpc)); } - action done { - parser->body_start = fpc - buffer + 1; + action done { + parser->body_start = fpc - buffer + 1; if(parser->header_done != NULL) parser->header_done(parser->data, fpc + 1, pe - fpc - 1); fbreak; @@ -98,7 +96,7 @@ int http_parser_init(http_parser *parser) { parser->mark = 0; parser->nread = 0; parser->field_len = 0; - parser->field_start = 0; + parser->field_start = 0; return(1); } |