aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2018-12-20 20:38:35 +0100
committerMax Kostikov <max@kostikov.co>2018-12-20 20:38:35 +0100
commit090fe394e4733aea9e9ca2e9a93c2c27b266d065 (patch)
tree10d0a3614e9f97f5065ea53fff1c3d5fcd292c16
parentec769bc9f948956a8093c675a14970461c5d8304 (diff)
downloadvolse-hubzilla-090fe394e4733aea9e9ca2e9a93c2c27b266d065.tar.gz
volse-hubzilla-090fe394e4733aea9e9ca2e9a93c2c27b266d065.tar.bz2
volse-hubzilla-090fe394e4733aea9e9ca2e9a93c2c27b266d065.zip
Fix cURL with HTTP/2
-rw-r--r--include/network.php17
1 files changed, 4 insertions, 13 deletions
diff --git a/include/network.php b/include/network.php
index 65770221f..8ac71011e 100644
--- a/include/network.php
+++ b/include/network.php
@@ -120,13 +120,8 @@ 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']);
@@ -165,7 +160,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].+? [1-5][0-9][0-9]/',$base)) {
+ while(preg_match('/^HTTP\/[1-3](\.\d)? [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));
@@ -298,12 +293,8 @@ 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']);
@@ -338,7 +329,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].+? [1-5][0-9][0-9]/',$base)) {
+ while(preg_match('/^HTTP\/[1-3](\.\d)? [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));