diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-11 15:18:49 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-11 15:18:49 +0000 |
commit | fa0e3fbb9120b4b004aa497dbe5c5faa811b3a93 (patch) | |
tree | 3330e7adda5951ed283263b1ecd6c059cf8ee1aa /contrib | |
parent | 0d2af41920254a8014daa213299d871318500f33 (diff) | |
download | rspamd-fa0e3fbb9120b4b004aa497dbe5c5faa811b3a93.tar.gz rspamd-fa0e3fbb9120b4b004aa497dbe5c5faa811b3a93.zip |
Try to fit options in 6 bits.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/http-parser/http_parser.c | 34 | ||||
-rw-r--r-- | contrib/http-parser/http_parser.h | 3 |
2 files changed, 18 insertions, 19 deletions
diff --git a/contrib/http-parser/http_parser.c b/contrib/http-parser/http_parser.c index 5295b6bdc..33f5ed301 100644 --- a/contrib/http-parser/http_parser.c +++ b/contrib/http-parser/http_parser.c @@ -1215,21 +1215,21 @@ size_t http_parser_execute (http_parser *parser, break; } - case s_req_spamc_start: - switch (ch) { - case 'S': - parser->flags |= F_SPAMC; - /* go forward */ - case 'R': - parser->state = s_req_spamc; - break; - case ' ': - break; - default: - SET_ERRNO(HPE_INVALID_CONSTANT); - goto error; - } - break; + case s_req_spamc_start: { + if (ch == 'S') { + parser->flags |= F_SPAMC; + parser->state = s_req_spamc; + } + else if (ch == 'R') { + parser->state = s_req_spamc; + } + else if (ch != ' ') { + SET_ERRNO(HPE_INVALID_CONSTANT); + goto error; + } + + break; + } case s_req_spamc: { @@ -1609,7 +1609,7 @@ size_t http_parser_execute (http_parser *parser, parser->flags |= F_CONNECTION_KEEP_ALIVE; break; case h_connection_close: - parser->flags |= F_CONNECTION_CLOSE; + /* XXX: not needed for rspamd parser->flags |= F_CONNECTION_CLOSE; */ break; case h_transfer_encoding_chunked: parser->flags |= F_CHUNKED; @@ -1959,7 +1959,7 @@ http_should_keep_alive (const http_parser *parser) { if (parser->http_major > 0 && parser->http_minor > 0) { /* HTTP/1.1 */ - if (parser->flags & F_CONNECTION_CLOSE) { + if (!(parser->flags & F_CONNECTION_KEEP_ALIVE)) { return 0; } } else { diff --git a/contrib/http-parser/http_parser.h b/contrib/http-parser/http_parser.h index f6f29b057..bac517f51 100644 --- a/contrib/http-parser/http_parser.h +++ b/contrib/http-parser/http_parser.h @@ -129,11 +129,10 @@ enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH }; enum flags { F_CHUNKED = 1 << 0 , F_CONNECTION_KEEP_ALIVE = 1 << 1 - , F_CONNECTION_CLOSE = 1 << 2 + , F_SPAMC = 1 << 2 , F_TRAILING = 1 << 3 , F_UPGRADE = 1 << 4 , F_SKIPBODY = 1 << 5 - , F_SPAMC = 1 << 6 }; |