From 70542686bb61795584775f4f5b974edea386b9b5 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sun, 9 Jun 2019 17:07:21 +0200 Subject: [PATCH] [contents] Fix parsing of incomplete headers Response headers may contain fields with no values. Example: "Referrer-Policy: " In this case the current implementation of explode() results in an error because there is no content after ": ". Changing the delimiter to ":" and trimming the value manually fixes that issue. --- lib/contents.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/contents.php b/lib/contents.php index c65d6dfb..958feb1b 100644 --- a/lib/contents.php +++ b/lib/contents.php @@ -322,8 +322,8 @@ function parseResponseHeader($header) { $header['http_code'] = $line; } else { - list ($key, $value) = explode(': ', $line); - $header[$key] = $value; + list ($key, $value) = explode(':', $line); + $header[$key] = trim($value); }