dovecot-2.2: lib-http: http-request-parser: Added function to te...

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 15 03:57:22 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/e53f5173fa2d
changeset: 16752:e53f5173fa2d
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sun Sep 15 03:55:11 2013 +0300
description:
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.

diffstat:

 src/lib-http/http-request-parser.c |  7 +++++++
 src/lib-http/http-request-parser.h |  2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r 7c7e3aa13de7 -r e53f5173fa2d src/lib-http/http-request-parser.c
--- 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)
diff -r 7c7e3aa13de7 -r e53f5173fa2d src/lib-http/http-request-parser.h
--- 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


More information about the dovecot-cvs mailing list