Handle certain rare web servers that don't start with \r\n
authorJonathan Dieter <jdieter@gmail.com>
Sat, 1 May 2021 16:56:16 +0000 (17:56 +0100)
committerJonathan Dieter <jdieter@gmail.com>
Sat, 1 May 2021 16:58:22 +0000 (17:58 +0100)
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 <jdieter@gmail.com>
src/lib/dl/multipart.c

index 683213ac10d6430cde57ea41c48ed40a647e94a5..f8c11dfa587eb59f97c536a89e7fadfabb7965f4 100644 (file)
@@ -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);