Support HTTP/2 responses

This commit is contained in:
Přemysl Eric Janouch 2019-10-02 23:56:30 +02:00
parent 361e0e52e0
commit b99a6ec8b2
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -57,7 +57,7 @@ sub get {
my $resp = communicate(@args, $url, $data);
die 'cannot download' if $? >> 8;
my ($code, $headers, $body) =
$resp =~ m#\AHTTP/\d\.\d (\d+) .*?\r\n(.*?)\r\n\r\n(.*)#sm;
$resp =~ m#\AHTTP/\d(?:\.\d)? (\d+) .*?\r\n(.*?)\r\n\r\n(.*)#sm;
return ($code, $body, { $headers =~ /(\S+?): (.*)\r\n/mg })
}