]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h1: Add EOH marker during headers parsing
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 25 Sep 2018 11:59:46 +0000 (13:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 12 Oct 2018 14:08:27 +0000 (16:08 +0200)
When headers parsing ends, a pseudo header with an empty name and an empty value
is added to the array of parsed headers to mark its end. It is convenient to
loop on this array, but not really useful if we want remove the last header or
add a new one, because we don't really know where is the last CRLF (the empty
line ending the headers block). So now, instead the name of this pseudo header
points on this last CRLF. Its length is still 0 and its value is still empty, so
loops on the array remains unchanged.

src/h1.c

index b1da880f835ad0434b658cde2542fe6abd88222f..660e7fd2ad210337156b11a5ccc686c78aa3fde9 100644 (file)
--- a/src/h1.c
+++ b/src/h1.c
@@ -1433,7 +1433,7 @@ int h1_headers_to_hdr_list(char *start, const char *stop,
                                state = H1_MSG_LAST_LF;
                                goto http_output_full;
                        }
-                       http_set_hdr(&hdr[hdr_count++], ist(""), ist(""));
+                       http_set_hdr(&hdr[hdr_count++], ist2(start+sol, 0), ist(""));
                }
 
                /* reaching here we've parsed the whole message. We may detect