chibipub

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 76c5013a0fabd086cdf3eb261bfad58b55a9afe7
parent f23455e96be8b607895cc3ce0c34fd53bb85581b
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 19 Nov 2020 12:22:32 -0800

consume crlf in last_segment

Diffstat:
Msrc/http.c | 10+++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/http.c b/src/http.c @@ -41,8 +41,7 @@ static int parse_last_segment(struct parser *p, char **seg) if (!parse_segment_with(p, seg, '\r')) return 0; - /* don't consume crlf yet */ - p->cur.p--; + consume_char(&p->cur, '\n'); return 1; } @@ -68,10 +67,7 @@ static int parse_request_line(struct http_req *req, struct parser *p) if (!parse_segment(p, &req->path)) return 0; - if (!parse_last_segment(p, &req->ver)) - return 0; - - return consume_crlf(&p->cur); + return parse_last_segment(p, &req->ver); } static int parse_header(struct http_header **prev, struct parser *p) @@ -99,7 +95,7 @@ static int parse_header(struct http_header **prev, struct parser *p) else (*prev)->next = next_p; - return consume_crlf(&p->cur); + return 1; }