diff options
author | Max Kostikov <max@kostikov.co> | 2018-12-20 21:09:16 +0100 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2018-12-20 21:09:16 +0100 |
commit | c82c0a98126dd5ed27b96f4a3991f91d9844ef76 (patch) | |
tree | fbca29895e38a691922460c227a4a0bcfaf5f416 /include | |
parent | 89e734dcca1525fa804343d6ecf5286ce70b05ba (diff) | |
parent | 123b1d40027ec53ac351ead017d969b1075bbac4 (diff) | |
download | volse-hubzilla-c82c0a98126dd5ed27b96f4a3991f91d9844ef76.tar.gz volse-hubzilla-c82c0a98126dd5ed27b96f4a3991f91d9844ef76.tar.bz2 volse-hubzilla-c82c0a98126dd5ed27b96f4a3991f91d9844ef76.zip |
Merge branch 'dev' into 'dev'
Dev
See merge request kostikov/core!2
Diffstat (limited to 'include')
-rw-r--r-- | include/network.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/include/network.php b/include/network.php index 8ac71011e..65770221f 100644 --- a/include/network.php +++ b/include/network.php @@ -120,8 +120,13 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']); } - if(array_key_exists('http_version',$opts)) + if(array_key_exists('http_version',$opts)) { @curl_setopt($ch,CURLOPT_HTTP_VERSION,$opts['http_version']); + } + else { + @curl_setopt($ch,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1); + } + if(x($opts,'cookiejar')) @curl_setopt($ch, CURLOPT_COOKIEJAR, $opts['cookiejar']); @@ -160,7 +165,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { // Pull out multiple headers, e.g. proxy and continuation headers // allow for HTTP/2.x without fixing code - while(preg_match('/^HTTP\/[1-3](\.\d)? [1-5][0-9][0-9]/',$base)) { + while(preg_match('/^HTTP\/[1-3].+? [1-5][0-9][0-9]/',$base)) { $chunk = substr($base,0,strpos($base,"\r\n\r\n")+4); $header .= $chunk; $base = substr($base,strlen($chunk)); @@ -293,8 +298,12 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']); } - if(array_key_exists('http_version',$opts)) + if(array_key_exists('http_version',$opts)) { @curl_setopt($ch,CURLOPT_HTTP_VERSION,$opts['http_version']); + } + else { + @curl_setopt($ch,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1); + } if(x($opts,'cookiejar')) @curl_setopt($ch, CURLOPT_COOKIEJAR, $opts['cookiejar']); @@ -329,7 +338,7 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) { // Pull out multiple headers, e.g. proxy and continuation headers // allow for HTTP/2.x without fixing code - while(preg_match('/^HTTP\/[1-3](\.\d)? [1-5][0-9][0-9]/',$base)) { + while(preg_match('/^HTTP\/[1-3].+? [1-5][0-9][0-9]/',$base)) { $chunk = substr($base,0,strpos($base,"\r\n\r\n")+4); $header .= $chunk; $base = substr($base,strlen($chunk)); |