aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2018-12-21 21:35:54 +0100
committerMario <mario@mariovavti.com>2018-12-21 21:35:54 +0100
commit458b023204e8195bcb15eacea98cc9dfdfaee46d (patch)
tree5fe8e6f0bd1c52f508a71de6b1f7a36dc8317349
parent4bad4ec632b9fe6a5563bf8c92631ddf919ab0a6 (diff)
parent60f890ce0dd95cf3c4f7cb72b61bcd71ec0c170a (diff)
downloadvolse-hubzilla-458b023204e8195bcb15eacea98cc9dfdfaee46d.tar.gz
volse-hubzilla-458b023204e8195bcb15eacea98cc9dfdfaee46d.tar.bz2
volse-hubzilla-458b023204e8195bcb15eacea98cc9dfdfaee46d.zip
Merge branch 'dev' into 'dev'
Fix for cURL with default HTTP/2 See merge request hubzilla/core!1447
-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));