summaryrefslogtreecommitdiff
path: root/test/it_url.t
diff options
context:
space:
mode:
Diffstat (limited to 'test/it_url.t')
-rwxr-xr-xtest/it_url.t48
1 files changed, 24 insertions, 24 deletions
diff --git a/test/it_url.t b/test/it_url.t
index a7e1ce3..02fe45c 100755
--- a/test/it_url.t
+++ b/test/it_url.t
@@ -136,7 +136,7 @@ require 'it_url_server.php';
is(it_url::is_reachable('http://www.gna.ch/'), true, "is_reachable('http://www.gna.ch/')");
is(it_url::is_reachable('http://www.search.ch/not_found'), false, "is_reachable('http://www.search.ch/not_found')");
is(it_url::is_reachable('http://bogus.url'), false, "is_reachable('http://bogus.url')");
-is(it_url::is_reachable(U('http://localhost:8000/redirect_loop', ['num' => 40])), false, "redirect loop is not reachable");
+is(it_url::is_reachable(U("http://$host/redirect_loop", ['num' => 40])), false, "redirect loop is not reachable");
$response = it_url::get(['url' => 'http://www.gna.ch/', 'assoc' => true]);
ok(
@@ -162,7 +162,7 @@ ok(
handle_server(
is(
- it_url::get('http://localhost:8000/'),
+ it_url::get("http://$host/"),
"Testserver root output",
'it_url::get() static call with port'
)
@@ -170,7 +170,7 @@ handle_server(
handle_server(
is(
- it_url::get('//localhost:8000/'),
+ it_url::get("//$host/"),
"Testserver root output",
'it_url::get() static call with port but no protocol'
)
@@ -178,7 +178,7 @@ handle_server(
handle_server(
is(
- it_url::get(['url' => 'http://localhost:8000/', 'maxlength' => 100]),
+ it_url::get(['url' => "http://$host/", 'maxlength' => 100]),
"Testserver root output",
'it_url::get() static call with port and maxlength'
)
@@ -186,7 +186,7 @@ handle_server(
handle_server(
is(
- it_url::get(['url' => 'http://localhost:8000/', 'maxlength' => 5, 'it_error' => false]),
+ it_url::get(['url' => "http://$host/", 'maxlength' => 5, 'it_error' => false]),
false,
'it_url::get() static call with port and too small maxlength'
)
@@ -194,7 +194,7 @@ handle_server(
handle_server(
is(
- it_url::get('http://localhost:8000/temp_redirect'),
+ it_url::get("http://$host/temp_redirect"),
"Testserver output after temporary redirect",
'it_url::get() follows temproary redirect'
)
@@ -202,7 +202,7 @@ handle_server(
handle_server(
is(
- it_url::get('http://localhost:8000/perm_redirect'),
+ it_url::get("http://$host/perm_redirect"),
"Testserver output after permanent redirect",
'it_url::get() follows permanent redirect'
)
@@ -210,7 +210,7 @@ handle_server(
handle_server(
is(
- it_url::get(['url' => 'http://localhost:8000/relative_redirect', 'it_error' => false]),
+ it_url::get(['url' => "http://$host/relative_redirect", 'it_error' => false]),
"Testserver output after relative redirect",
'it_url::get() follows relative redirect correctly'
)
@@ -218,7 +218,7 @@ handle_server(
handle_server(
is(
- it_url::get('http://localhost:8000/nohost_redirect'),
+ it_url::get("http://$host/nohost_redirect"),
"Testserver output after nohost redirect",
'it_url::get() follows redirect without host correctly'
)
@@ -226,7 +226,7 @@ handle_server(
handle_server(
is(
- it_url::get('http://localhost:8000/created_redirect'),
+ it_url::get("http://$host/created_redirect"),
"Testserver output *before* created redirect",
'it_url::get() does not follow Location of 201 (Created) result'
)
@@ -234,7 +234,7 @@ handle_server(
$output = handle_server(
ok(
- !it_url::get(['url' => U('http://localhost:8000/redirect_loop', ['num' => 40]), 'it_error' => false]),
+ !it_url::get(['url' => U("http://$host/redirect_loop", ['num' => 40]), 'it_error' => false]),
'it_url::get() handles redirect loop'
)
);
@@ -247,7 +247,7 @@ if (!ok(
$output = handle_server(
ok(
- !it_url::get(['url' => 'http://localhost:8000/does_not_exist', 'retries' => 4]),
+ !it_url::get(['url' => "http://$host/does_not_exist", 'retries' => 4]),
'it_url::get() on 404'
)
);
@@ -259,7 +259,7 @@ if (!ok(
$output = handle_server(
ok(
- !it_url::get(['url' => 'http://localhost:8000/repeat?num=0', 'retries' => 4]),
+ !it_url::get(['url' => "http://$host/repeat?num=0", 'retries' => 4]),
'it_url::get() on empty page'
)
);
@@ -271,7 +271,7 @@ if (!ok(
$output = handle_server(
is(
- it_url::get(U('http://localhost:8000/empty')),
+ it_url::get(U("http://$host/empty")),
'',
'it_url::get() explicit empty result'
)
@@ -284,15 +284,15 @@ if (!ok(
handle_server(
is(
- it_url::get(U('http://localhost:8000/get_server_value', ['key' => 'HTTP_HOST'])),
- 'localhost:8000',
+ it_url::get(U("http://$host/get_server_value", ['key' => 'HTTP_HOST'])),
+ $host,
'it_url::get() sets correct Host header'
)
);
handle_server(
is(
- it_url::get(U('http://localhost:8000/get_server_value', ['key' => 'HTTP_ACCEPT_LANGUAGE'])),
+ it_url::get(U("http://$host/get_server_value", ['key' => 'HTTP_ACCEPT_LANGUAGE'])),
T_lang(),
'it_url::get() sets correct Accept-Language header'
)
@@ -300,14 +300,14 @@ handle_server(
handle_server(
ok(
- it::match('Mozilla', it_url::get(U('http://localhost:8000/get_server_value', ['key' => 'HTTP_USER_AGENT']))),
+ it::match('Mozilla', it_url::get(U("http://$host/get_server_value", ['key' => 'HTTP_USER_AGENT']))),
'it_url::get() sets User-Agent containing Mozilla'
)
);
handle_server(
is(
- it_url::get(U('http://user:password@localhost:8000/get_server_value', ['key' => 'PHP_AUTH_USER'])),
+ it_url::get(U("http://user:password@$host/get_server_value", ['key' => 'PHP_AUTH_USER'])),
'user',
'it_url::get() basic authentication user'
)
@@ -315,7 +315,7 @@ handle_server(
handle_server(
is(
- it_url::get(U('http://user:password@localhost:8000/get_server_value', ['key' => 'PHP_AUTH_PW'])),
+ it_url::get(U("http://user:password@$host/get_server_value", ['key' => 'PHP_AUTH_PW'])),
'password',
'it_url::get() basic authentication password'
)
@@ -328,20 +328,20 @@ is(count($pages), 2, 'it_url::get_multi no additional array elements');
handle_server(
is(
- it_url::get('http://localhost:8000/maybe_error?chance=0'),
+ it_url::get("http://$host/maybe_error?chance=0"),
"success"
),
is(
- it_url::get('http://localhost:8000/maybe_error?chance=100'),
+ it_url::get("http://$host/maybe_error?chance=100"),
"failure"
),
is(
- it_url::get(['url' => 'http://localhost:8000/maybe_error?chance=10', 'retries' => 10]),
+ it_url::get(['url' => "http://$host/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://$host/maybe_error?chance=10"], 'retries' => 10]),
["success"],
"Retry on sporadically failing url in ::get_multi"
)