diff --git a/http_parser.h b/http_parser.h index ead1e5e..7d46cdf 100644 --- a/http_parser.h +++ b/http_parser.h @@ -145,7 +145,16 @@ 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_should_keep_alive (http_parser *parser); +static inline int +http_parser_should_keep_alive (http_parser *parser) +{ + if (parser->keep_alive == -1) { + if (parser->version_major == 1) return (parser->version_minor != 0); + return 0; + } + return parser->keep_alive; +} + #ifdef __cplusplus } diff --git a/http_parser.rl b/http_parser.rl index 7368dea..8cc6118 100644 --- a/http_parser.rl +++ b/http_parser.rl @@ -488,17 +488,3 @@ http_parser_has_error (http_parser *parser) if (parser->error) return 1; return parser->cs == http_parser_error; } - -int -http_parser_should_keep_alive (http_parser *parser) -{ - if (parser->keep_alive == -1) - if (parser->version_major == 1) - return (parser->version_minor != 0); - else if (parser->version_major == 0) - return 0; - else - return 1; - else - return parser->keep_alive; -}