diff options
author | gue5t <gue5t@midori.launchpad> | 2015-06-13 17:03:38 +0000 |
---|---|---|
committer | RabbitBot <> | 2015-06-13 17:03:38 +0000 |
commit | dadb697301666892c33e587a2741321cc6a9583d (patch) | |
tree | a00cb99275e01d1623dbab85785eb81a36325279 /tests | |
parent | 89cf9fefbe50ec8deb5edec10cce8a02cad7a2ee (diff) | |
parent | 54b179d0ea3cd9881fb9c82d75263e1f371143fe (diff) | |
download | midori-git-dadb697301666892c33e587a2741321cc6a9583d.tar.gz |
avoid deprecated SoupServer API with libsoup 2.48
Diffstat (limited to 'tests')
-rw-r--r-- | tests/download.vala | 14 | ||||
-rw-r--r-- | tests/tab.vala | 14 |
2 files changed, 26 insertions, 2 deletions
diff --git a/tests/download.vala b/tests/download.vala index a3dc561a..4e2d641c 100644 --- a/tests/download.vala +++ b/tests/download.vala @@ -69,11 +69,23 @@ static void download_unique () { } void download_properties () { +#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)=>{ Thread.usleep (1000000); /* 1 seconds in µs */ if ("/not_found/" in path) 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); |