diff options
author | VirtualTam <virtualtam@flibidi.net> | 2018-10-13 00:19:03 +0200 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2018-12-02 22:39:16 +0100 |
commit | f211e417bf637b8a83988175c29ee072c69f7642 (patch) | |
tree | c33378b38ff1bd16e90934b5c60467a7e0395f53 /application/HttpUtils.php | |
parent | 04ec8fedd91642d4c0fc96258868086b8a51c899 (diff) | |
download | Shaarli-f211e417bf637b8a83988175c29ee072c69f7642.tar.gz Shaarli-f211e417bf637b8a83988175c29ee072c69f7642.tar.zst Shaarli-f211e417bf637b8a83988175c29ee072c69f7642.zip |
lint: apply phpcbf to application/
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'application/HttpUtils.php')
-rw-r--r-- | application/HttpUtils.php | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/application/HttpUtils.php b/application/HttpUtils.php index e9282506..ef6f3264 100644 --- a/application/HttpUtils.php +++ b/application/HttpUtils.php | |||
@@ -64,29 +64,30 @@ function get_http_response($url, $timeout = 30, $maxBytes = 4194304, $curlWriteF | |||
64 | } | 64 | } |
65 | 65 | ||
66 | // General cURL settings | 66 | // General cURL settings |
67 | curl_setopt($ch, CURLOPT_AUTOREFERER, true); | 67 | curl_setopt($ch, CURLOPT_AUTOREFERER, true); |
68 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | 68 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
69 | curl_setopt($ch, CURLOPT_HEADER, true); | 69 | curl_setopt($ch, CURLOPT_HEADER, true); |
70 | curl_setopt( | 70 | curl_setopt( |
71 | $ch, | 71 | $ch, |
72 | CURLOPT_HTTPHEADER, | 72 | CURLOPT_HTTPHEADER, |
73 | array('Accept-Language: ' . $acceptLanguage) | 73 | array('Accept-Language: ' . $acceptLanguage) |
74 | ); | 74 | ); |
75 | curl_setopt($ch, CURLOPT_MAXREDIRS, $maxRedirs); | 75 | curl_setopt($ch, CURLOPT_MAXREDIRS, $maxRedirs); |
76 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | 76 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
77 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); | 77 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
78 | curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); | 78 | curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); |
79 | 79 | ||
80 | if (is_callable($curlWriteFunction)) { | 80 | if (is_callable($curlWriteFunction)) { |
81 | curl_setopt($ch, CURLOPT_WRITEFUNCTION, $curlWriteFunction); | 81 | curl_setopt($ch, CURLOPT_WRITEFUNCTION, $curlWriteFunction); |
82 | } | 82 | } |
83 | 83 | ||
84 | // Max download size management | 84 | // Max download size management |
85 | curl_setopt($ch, CURLOPT_BUFFERSIZE, 1024*16); | 85 | curl_setopt($ch, CURLOPT_BUFFERSIZE, 1024*16); |
86 | curl_setopt($ch, CURLOPT_NOPROGRESS, false); | 86 | curl_setopt($ch, CURLOPT_NOPROGRESS, false); |
87 | curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, | 87 | curl_setopt( |
88 | function($arg0, $arg1, $arg2, $arg3, $arg4 = 0) use ($maxBytes) | 88 | $ch, |
89 | { | 89 | CURLOPT_PROGRESSFUNCTION, |
90 | function ($arg0, $arg1, $arg2, $arg3, $arg4 = 0) use ($maxBytes) { | ||
90 | if (version_compare(phpversion(), '5.5', '<')) { | 91 | if (version_compare(phpversion(), '5.5', '<')) { |
91 | // PHP version lower than 5.5 | 92 | // PHP version lower than 5.5 |
92 | // Callback has 4 arguments | 93 | // Callback has 4 arguments |
@@ -232,7 +233,6 @@ function get_redirected_headers($url, $redirectionLimit = 3) | |||
232 | && !empty($headers) | 233 | && !empty($headers) |
233 | && (strpos($headers[0], '301') !== false || strpos($headers[0], '302') !== false) | 234 | && (strpos($headers[0], '301') !== false || strpos($headers[0], '302') !== false) |
234 | && !empty($headers['Location'])) { | 235 | && !empty($headers['Location'])) { |
235 | |||
236 | $redirection = is_array($headers['Location']) ? end($headers['Location']) : $headers['Location']; | 236 | $redirection = is_array($headers['Location']) ? end($headers['Location']) : $headers['Location']; |
237 | if ($redirection != $url) { | 237 | if ($redirection != $url) { |
238 | $redirection = getAbsoluteUrl($url, $redirection); | 238 | $redirection = getAbsoluteUrl($url, $redirection); |