summaryrefslogtreecommitdiff
path: root/tests/tab.vala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tab.vala')
-rw-r--r--tests/tab.vala14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/tab.vala b/tests/tab.vala
index de08953c..37814e28 100644
--- a/tests/tab.vala
+++ b/tests/tab.vala
@@ -178,11 +178,23 @@ void tab_http () {
browser.add_tab (tab);
var loop = MainContext.default ();
+#if HAVE_LIBSOUP_2_48_0
+ var test_server = new Soup.Server ("server-header", null, null);
+ try {
+ test_server.listen_local (0, Soup.ServerListenOptions.IPV4_ONLY);
+ }
+ catch (Error error) {
+ GLib.error (error.message);
+ }
+ var port = test_server.get_uris ().data.port;
+#else
var test_address = new Soup.Address ("127.0.0.1", Soup.ADDRESS_ANY_PORT);
test_address.resolve_sync (null);
var test_server = new Soup.Server ("interface", test_address, null);
- string test_url = "http://127.0.0.1:%u".printf (test_server.get_port ());
test_server.run_async ();
+ var port = test_server.get_port ();
+#endif
+ string test_url = "http://127.0.0.1:%u".printf (port);
test_server.add_handler ("/", (server, msg, path, query, client)=>{
msg.set_status_full (200, "OK");
msg.response_body.append_take ("<body></body>".data);