]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: http-request-parser: Added function to test whether payload from previous...
authorStephan Bosch <stephan@rename-it.nl>
Sun, 15 Sep 2013 00:55:11 +0000 (03:55 +0300)
committerStephan Bosch <stephan@rename-it.nl>
Sun, 15 Sep 2013 00:55:11 +0000 (03:55 +0300)
This is needed in the server implementation to check whether a request is
completely read.

src/lib-http/http-request-parser.c
src/lib-http/http-request-parser.h

index dab94ceea07d3a0345f32a6847d1e68de19867fd..328c0acbac7200977565e309357a5bd9a0e60bab 100644 (file)
@@ -327,6 +327,13 @@ http_request_parser_message_error(struct http_request_parser *parser)
        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)
index 2cf079a63a2a95f7f4201be44c671d671eafe09d..a589630677f736bd03097a8676c2031fec7daa81 100644 (file)
@@ -24,4 +24,6 @@ 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);
 
+bool http_request_parser_pending_payload(struct http_request_parser *parser);
+
 #endif