Skip to content

Commit

Permalink
[contents] Fix parsing of incomplete headers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
logmanoriginal committed Jun 9, 2019
1 parent edf10be commit 7054268
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/contents.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

Expand Down

0 comments on commit 7054268

Please sign in to comment.