summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2020-08-10 16:22:13 +0200
committerUrban Müller2020-08-10 16:32:38 +0200
commita21a7991a7fc21321b90614b609b316fca54daa7 (patch)
tree39f58151fe3a19d46799ef8712a5295e93314075
parent7eac01f1c0327fb5b16a6d2581cae31fb27bdc11 (diff)
downloaditools-a21a7991a7fc21321b90614b609b316fca54daa7.tar.gz
itools-a21a7991a7fc21321b90614b609b316fca54daa7.tar.bz2
itools-a21a7991a7fc21321b90614b609b316fca54daa7.zip
vanilla php compliance
-rw-r--r--it_url.class4
-rwxr-xr-xtest/it_url.t6
2 files changed, 5 insertions, 5 deletions
diff --git a/it_url.class b/it_url.class
index fa58d88..54128dd 100644
--- a/it_url.class
+++ b/it_url.class
@@ -173,13 +173,13 @@ static function _default_headers($url, $p)
if ((!it::is_devel() || EDC('subreqcheck')) && $p['url'] && !$p['headers']['Accept-Language'] && T_lang() != T_defaultlang() && $search_subrequest && !it::match('\blogin\.|banner\.html|machines\.txt|mbtiles\.php|/itjs/|/images/|\.(de|fr|en|it)(\.js|\.html|\.txt|\.php|\.ics|\.pdf|\.json|\.csv|\.gif|\.jpg|\.png)', $p['url']))
it::error(['title' => "Subrequest without language override", 'body' => [ $p ]]);
- $headers = array_filter(
+ $headers = array_filter([
'Host' => $url->realhostname . $url->explicitport,
'User-Agent' => "Mozilla/5.0 (compatible; ITools; Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582)",
'Accept-Language' => $p['headers']['Accept-Language'] ?: ($search_subrequest ? T_defaultlang() : T_lang()), # can prevent loading of it_text
'Referer' => it::match('([-\w]+\.\w+)$', $url->hostname) == it::match('([-\w]+\.\w+)$', $_SERVER['HTTP_HOST']) ? it_url::absolute(U($_GET)) : null,
'X-Ultra-Https' => $_SERVER['HTTPS'],
- );
+ ]);
if (is_int($p['filemtime']))
$headers['If-Modified-Since'] = date("r", $p['filemtime']);
return $headers;
diff --git a/test/it_url.t b/test/it_url.t
index 1636bd6..360b971 100755
--- a/test/it_url.t
+++ b/test/it_url.t
@@ -326,15 +326,15 @@ handle_server(
"failure"
),
is(
- it_url::get('url' => 'http://localhost:8000/maybe_error?chance=10', 'retries' => 10),
+ it_url::get(['url' => 'http://localhost:8000/maybe_error?chance=10', 'retries' => 10]),
"success",
"Retry on sporadically failing url in ::get"
),
is(
- it_url::get_multi('urls' => ['http://localhost:8000/maybe_error?chance=10'], 'retries' => 10),
+ it_url::get_multi(['urls' => ['http://localhost:8000/maybe_error?chance=10'], 'retries' => 10]),
["success"],
"Retry on sporadically failing url in ::get_multi"
- ),
+ )
);
is(it_url::parse("/foo"), ["/foo"], "it_url::parse path only");