Mercurial > dovecot > original-hg > dovecot-2.2
changeset 16752:e53f5173fa2d
lib-http: http-request-parser: Added function to test whether payload from previous request is still being parsed.
This is needed in the server implementation to check whether a request is
completely read.
author | Stephan Bosch <stephan@rename-it.nl> |
---|---|
date | Sun, 15 Sep 2013 03:55:11 +0300 |
parents | 7c7e3aa13de7 |
children | 9da90cf29d91 |
files | src/lib-http/http-request-parser.c src/lib-http/http-request-parser.h |
diffstat | 2 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-http/http-request-parser.c Sun Sep 15 03:54:04 2013 +0300 +++ b/src/lib-http/http-request-parser.c Sun Sep 15 03:55:11 2013 +0300 @@ -327,6 +327,13 @@ return HTTP_REQUEST_PARSE_ERROR_BROKEN_REQUEST; } +bool http_request_parser_pending_payload(struct http_request_parser *parser) +{ + if (parser->parser.payload == NULL) + return FALSE; + return i_stream_have_bytes_left(parser->parser.payload); +} + int http_request_parse_next(struct http_request_parser *parser, pool_t pool, struct http_request *request, enum http_request_parse_error *error_code_r, const char **error_r)
--- a/src/lib-http/http-request-parser.h Sun Sep 15 03:54:04 2013 +0300 +++ b/src/lib-http/http-request-parser.h Sun Sep 15 03:55:11 2013 +0300 @@ -24,4 +24,6 @@ pool_t pool, struct http_request *request, enum http_request_parse_error *error_code_r, const char **error_r); +bool http_request_parser_pending_payload(struct http_request_parser *parser); + #endif