From 276acf58954705cdd260494a17249c2686d60425 Mon Sep 17 00:00:00 2001 From: Jonathan Dieter Date: Sat, 1 May 2021 17:56:16 +0100 Subject: [PATCH] Handle certain rare web servers that don't start with \r\n After testing the server in https://github.com/zchunk/zchunk/issues/40, I found that it doesn't start with "\r\n", so let's make that part optional Signed-off-by: Jonathan Dieter --- src/lib/dl/multipart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/dl/multipart.c b/src/lib/dl/multipart.c index 683213a..f8c11df 100644 --- a/src/lib/dl/multipart.c +++ b/src/lib/dl/multipart.c @@ -74,7 +74,7 @@ static bool gen_regex(zckDL *dl) { /* Response should include content-type, but we only need the range, so * wildcard out the content-type */ - char *next = "\r\n--%s\r\n.*" \ + char *next = "\r?\n?--%s\r\n.*" \ "content-range: *bytes *([0-9]+) *- *([0-9]+) */[0-9]+"; char *end = "\r\n--%s--"; char *regex_n = add_boundary_to_regex(dl->zck, next, dl->boundary); -- 2.30.2