mirror of
https://github.com/friendica/friendica
synced 2024-11-11 11:42:53 +00:00
Workaround for HTTP error 417
This commit is contained in:
parent
046b5a1eac
commit
5ea8116cfd
1 changed files with 19 additions and 4 deletions
|
@ -284,8 +284,8 @@ class Network
|
|||
$curl_time = Config::get('system', 'curl_timeout', 60);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, intval($curl_time));
|
||||
}
|
||||
|
||||
if (defined('LIGHTTPD')) {
|
||||
/*
|
||||
// if (defined('LIGHTTPD')) {
|
||||
if (empty($headers)) {
|
||||
$headers = ['Expect:'];
|
||||
} else {
|
||||
|
@ -293,8 +293,8 @@ class Network
|
|||
array_push($headers, 'Expect:');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
*/
|
||||
if (!empty($headers)) {
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
}
|
||||
|
@ -336,6 +336,21 @@ class Network
|
|||
curl_close($ch);
|
||||
|
||||
$a->getProfiler()->saveTimestamp($stamp1, 'network', System::callstack());
|
||||
Logger::info('Blubb', ['code' => $curlResponse->getReturnCode()]);
|
||||
// Some servers 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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue