Browse Source

Merge pull request #7753 from annando/http-417

Handling for HTTP Error code 417
pull/7758/head
Hypolite Petovan 2 years ago
committed by GitHub
parent
commit
1a8bc6e73f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      src/Util/Network.php

25
src/Util/Network.php

@ -285,16 +285,6 @@ class Network
curl_setopt($ch, CURLOPT_TIMEOUT, intval($curl_time));
}
if (defined('LIGHTTPD')) {
if (empty($headers)) {
$headers = ['Expect:'];
} else {
if (!in_array('Expect:', $headers)) {
array_push($headers, 'Expect:');
}
}
}
if (!empty($headers)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}
@ -337,6 +327,21 @@ class Network
$a->getProfiler()->saveTimestamp($stamp1, 'network', System::callstack());
// Very old versions of Lighttpd don't like the "Expect" header, so we remove it when needed
if ($curlResponse->getReturnCode() == 417) {
$redirects++;
if (empty($headers)) {
$headers = ['Expect:'];
} else {
if (!in_array('Expect:', $headers)) {
array_push($headers, 'Expect:');
}
}
Logger::info('Server responds with 417, applying workaround', ['url' => $url]);
return self::post($url, $params, $headers, $redirects, $timeout);
}
Logger::log('post_url: end ' . $url, Logger::DATA);
return $curlResponse;

Loading…
Cancel
Save