]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: message parsers: Record beginning of parsed data.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Mon, 19 Feb 2018 12:20:11 +0000 (13:20 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Mon, 12 Mar 2018 09:07:37 +0000 (11:07 +0200)
src/lib-http/http-message-parser.h
src/lib-http/http-request-parser.c
src/lib-http/http-response-parser.c

index 3675319bb530e4ba2090f1af34d1fa3ace99a1f2..17c17cb2b5b5e7b4cb401e4ef1f21cb5ce8e0bf2 100644 (file)
@@ -47,7 +47,7 @@ struct http_message_parser {
        uoff_t max_payload_size;
        enum http_message_parse_flags flags;
 
-       const unsigned char *cur, *end;
+       const unsigned char *begin, *cur, *end;
 
        const char *error;
        enum http_message_parse_error error_code;
index 52d3213ee149f81390cd2292829892eb49115926..226eb709ec4afd62b30fb8875fa344f0b3c35703 100644 (file)
@@ -292,8 +292,8 @@ static int http_request_parse_request_line(struct http_request_parser *parser,
 
        while ((ret = i_stream_read_bytes(_parser->input, &begin, &size,
                                          old_bytes + 1)) > 0) {
-               _parser->cur = begin;
-               _parser->end = _parser->cur + size;
+               _parser->begin = _parser->cur = begin;
+               _parser->end = _parser->begin + size;
 
                if ((ret = http_request_parse(parser, pool)) < 0)
                        return -1;
index 209a18a7cd0165b6f90dce4c5e4554630cf2d998..959afdbdb025167d91caec5c9ba41c85eecff2da 100644 (file)
@@ -244,8 +244,8 @@ http_response_parse_status_line(struct http_response_parser *parser)
 
        while ((ret = i_stream_read_bytes(_parser->input, &begin, &size,
                                          old_bytes + 1)) > 0) {
-               _parser->cur = begin;
-               _parser->end = _parser->cur + size;
+               _parser->begin = _parser->cur = begin;
+               _parser->end = _parser->begin + size;
 
                if ((ret = http_response_parse(parser)) < 0)
                        return -1;