From 0845d2da1fc9df6b25e7fd0d72ec436fc09081f9 Mon Sep 17 00:00:00 2001 From: David King Date: Sun, 18 Jun 2023 11:25:06 +0100 Subject: [PATCH] Update to 0.5.2 --- .gitignore | 1 + libproxy-0.5.0-post-release-fixes.patch | 537 ------------------------ libproxy.spec | 5 +- sources | 2 +- 4 files changed, 6 insertions(+), 539 deletions(-) delete mode 100644 libproxy-0.5.0-post-release-fixes.patch diff --git a/.gitignore b/.gitignore index a587aef..5ea8db7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /libproxy-0.4.17.tar.xz /libproxy-0.4.18.tar.xz /0.5.1.tar.gz +/0.5.2.tar.gz diff --git a/libproxy-0.5.0-post-release-fixes.patch b/libproxy-0.5.0-post-release-fixes.patch deleted file mode 100644 index f4fa004..0000000 --- a/libproxy-0.5.0-post-release-fixes.patch +++ /dev/null @@ -1,537 +0,0 @@ -From f6aab7bc2a821117b2079f7504ab444dd13f4708 Mon Sep 17 00:00:00 2001 -From: Jan-Michael Brummer -Date: Tue, 16 May 2023 15:10:53 +0200 -Subject: [PATCH 1/7] Guard PxManager test with pacrunner-duktape option (#215) - -Fixes: https://github.com/libproxy/libproxy/issues/213 ---- - tests/meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/meson.build b/tests/meson.build -index 4ae8e7d..c8fe11f 100644 ---- a/tests/meson.build -+++ b/tests/meson.build -@@ -17,7 +17,7 @@ if get_option('tests') - env: envs - ) - -- if soup_dep.found() -+ if soup_dep.found() and get_option('pacrunner-duktape') - px_manager_test = executable('test-px-manager', - ['px-manager-test.c', 'px-manager-helper.c'], - include_directories: px_backend_inc, --- -2.40.1 - - -From 917e8be8756ae8f7bf502c23499fd6a605e9871e Mon Sep 17 00:00:00 2001 -From: Thomas Klausner -Date: Wed, 17 May 2023 21:05:44 +0200 -Subject: [PATCH 2/7] Fix build on NetBSD (#220) - -Closes #219 ---- - src/backend/plugins/pacrunner-duktape/pacrunner-duktape.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/backend/plugins/pacrunner-duktape/pacrunner-duktape.c b/src/backend/plugins/pacrunner-duktape/pacrunner-duktape.c -index 3845fca..40137ca 100644 ---- a/src/backend/plugins/pacrunner-duktape/pacrunner-duktape.c -+++ b/src/backend/plugins/pacrunner-duktape/pacrunner-duktape.c -@@ -26,6 +26,7 @@ - #include - #else - #include -+#include - #endif - - #include "pacrunner-duktape.h" --- -2.40.1 - - -From 383681b0111e29bafe513cbbf4c6fe6e7129714f Mon Sep 17 00:00:00 2001 -From: David King -Date: Mon, 22 May 2023 06:59:06 +0100 -Subject: [PATCH 3/7] Install libpxbackend into pkglibdir (#223) - -Fixes: https://github.com/libproxy/libproxy/issues/222 ---- - meson.build | 2 +- - src/backend/meson.build | 4 +++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/meson.build b/meson.build -index f209f60..b6bda0d 100644 ---- a/meson.build -+++ b/meson.build -@@ -12,7 +12,7 @@ root_dir = include_directories('.') - - px_prefix = get_option('prefix') - datadir = get_option('datadir') --px_libdir = join_paths(px_prefix, get_option('libdir')) -+pkglibdir = join_paths(px_prefix, get_option('libdir'), 'libproxy') - girdir = get_option('datadir') / 'gir-1.0' - typelibdir = get_option('libdir') / 'girepository-1.0' - vapidir = get_option('datadir') / 'vala' / 'vapi' -diff --git a/src/backend/meson.build b/src/backend/meson.build -index c8be5da..ce5a242 100644 ---- a/src/backend/meson.build -+++ b/src/backend/meson.build -@@ -37,7 +37,9 @@ px_backend = shared_library( - px_backend_sources, - dependencies: px_backend_deps, - c_args: px_backend_c_args, -- install: true -+ install: true, -+ install_dir: pkglibdir, -+ install_rpath: pkglibdir - ) - - px_backend_dep = declare_dependency( --- -2.40.1 - - -From d32f1e65bf54d5d9cae9e9f57d04ce34005b90f0 Mon Sep 17 00:00:00 2001 -From: Thomas Klausner -Date: Mon, 22 May 2023 08:56:50 +0200 -Subject: [PATCH 4/7] Move glib2 inclusion out of c++ protection (#227) - -Fixes usage of header file from C++ - -Addresses one part of #226. ---- - src/libproxy/proxy.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/libproxy/proxy.h b/src/libproxy/proxy.h -index cf4fc34..1289f41 100644 ---- a/src/libproxy/proxy.h -+++ b/src/libproxy/proxy.h -@@ -22,12 +22,12 @@ - - #pragma once - -+#include -+ - #ifdef __cplusplus - extern "C" { - #endif - --#include -- - /** - * SECTION:px-proxy - * @short_description: A convient helper for using proxy servers --- -2.40.1 - - -From 14430634e1bb003c5f6e7b83caca60c08e5579bd Mon Sep 17 00:00:00 2001 -From: Jan-Michael Brummer -Date: Mon, 22 May 2023 11:01:00 +0200 -Subject: [PATCH 5/7] Replace libsoup with glib socket service functions (#228) - ---- - meson.build | 1 - - tests/config-kde-test.c | 4 +- - tests/data/px-manager-pac | 6 +- - tests/data/sample-kde-proxy-disabled | 2 +- - tests/data/sample-kde-proxy-pac | 2 +- - tests/meson.build | 4 +- - tests/px-manager-test.c | 143 ++++++++++++++++++++++----- - 7 files changed, 127 insertions(+), 35 deletions(-) - -diff --git a/meson.build b/meson.build -index b6bda0d..49a5fb4 100644 ---- a/meson.build -+++ b/meson.build -@@ -106,7 +106,6 @@ endif - - glib_dep = dependency('glib-2.0', version: '>= 2.71.3') - gio_dep = dependency('gio-2.0', version: '>= 2.71.3') --soup_dep = dependency('libsoup-3.0', required: get_option('tests')) - curl_dep = dependency('libcurl', required: get_option('curl')) - ws2_32_dep = cc.find_library('ws2_32', required : with_platform_windows) - gsettings_desktop_schema = dependency('gsettings-desktop-schemas', required: get_option('config-gnome')) -diff --git a/tests/config-kde-test.c b/tests/config-kde-test.c -index 5129384..07f83f9 100644 ---- a/tests/config-kde-test.c -+++ b/tests/config-kde-test.c -@@ -168,9 +168,9 @@ test_config_kde_pac (void) - - config = px_manager_get_configuration (manager, uri, &error); - if (test.success) -- g_assert_cmpstr (config[0], ==, "pac+http://127.0.0.1/test.pac"); -+ g_assert_cmpstr (config[0], ==, "pac+http://127.0.0.1/px-manager-sample.pac"); - else -- g_assert_cmpstr (config[0], !=, "pac+http://127.0.0.1/test.pac"); -+ g_assert_cmpstr (config[0], !=, "pac+http://127.0.0.1/px-manager-sample.pac"); - - g_clear_object (&manager); - } -diff --git a/tests/data/px-manager-pac b/tests/data/px-manager-pac -index 2ff4000..cb74134 100644 ---- a/tests/data/px-manager-pac -+++ b/tests/data/px-manager-pac -@@ -1,5 +1,5 @@ - PROXY_ENABLED="yes" --HTTP_PROXY="pac+http://127.0.0.1:1983/test.pac" --HTTPS_PROXY="pac+http://127.0.0.1:1983/test.pac" --FTP_PROXY="pac+http://127.0.0.1:1983/test.pac" -+HTTP_PROXY="pac+http://127.0.0.1:1983/px-manager-sample.pac" -+HTTPS_PROXY="pac+http://127.0.0.1:1983/px-manager-sample.pac" -+FTP_PROXY="pac+http://127.0.0.1:1983/px-manager-sample.pac" - NO_PROXY="localhost, 127.0.0.1" -diff --git a/tests/data/sample-kde-proxy-disabled b/tests/data/sample-kde-proxy-disabled -index 9598abd..1c8aa46 100644 ---- a/tests/data/sample-kde-proxy-disabled -+++ b/tests/data/sample-kde-proxy-disabled -@@ -2,7 +2,7 @@ ProxyUrlDisplayFlags=15 - - [Proxy Settings] - NoProxyFor=localhost,127.0.0.1 --Proxy Config Script=http://127.0.0.1/test.pac -+Proxy Config Script=http://127.0.0.1/px-manager-sample.pac - ProxyType=0 - ReversedException=false - ftpProxy=ftp://127.0.0.1 8080 -diff --git a/tests/data/sample-kde-proxy-pac b/tests/data/sample-kde-proxy-pac -index c0db824..c051879 100644 ---- a/tests/data/sample-kde-proxy-pac -+++ b/tests/data/sample-kde-proxy-pac -@@ -2,7 +2,7 @@ ProxyUrlDisplayFlags=15 - - [Proxy Settings] - NoProxyFor=localhost,127.0.0.1 --Proxy Config Script=http://127.0.0.1/test.pac -+Proxy Config Script=http://127.0.0.1/px-manager-sample.pac - ProxyType=2 - ReversedException=false - ftpProxy=ftp://127.0.0.1 8080 -diff --git a/tests/meson.build b/tests/meson.build -index c8fe11f..f955f15 100644 ---- a/tests/meson.build -+++ b/tests/meson.build -@@ -17,11 +17,11 @@ if get_option('tests') - env: envs - ) - -- if soup_dep.found() and get_option('pacrunner-duktape') -+ if get_option('pacrunner-duktape') - px_manager_test = executable('test-px-manager', - ['px-manager-test.c', 'px-manager-helper.c'], - include_directories: px_backend_inc, -- dependencies: [soup_dep, glib_dep, px_backend_dep], -+ dependencies: [glib_dep, px_backend_dep], - ) - test('PX Manager test', - px_manager_test, -diff --git a/tests/px-manager-test.c b/tests/px-manager-test.c -index bfd3112..311e632 100644 ---- a/tests/px-manager-test.c -+++ b/tests/px-manager-test.c -@@ -22,7 +22,7 @@ - #include "px-manager.h" - #include "px-manager-helper.h" - --#include -+#include - - #define SERVER_PORT 1983 - -@@ -32,27 +32,120 @@ typedef struct { - } Fixture; - - static void --server_callback (SoupServer *server, -- SoupServerMessage *msg, -- const char *path, -- GHashTable *query, -- gpointer data) -+send_error (GOutputStream *out, -+ int error_code, -+ const char *reason) - { -- g_print ("%s: path %s\n", __FUNCTION__, path); -- soup_server_message_set_status (SOUP_SERVER_MESSAGE (msg), SOUP_STATUS_OK, NULL); -- -- if (g_strcmp0 (path, "/test.pac") == 0) { -- g_autofree char *pac = g_test_build_filename (G_TEST_DIST, "data", "px-manager-sample.pac", NULL); -- g_autofree char *pac_data = NULL; -- g_autoptr (GError) error = NULL; -- gsize len; -- -- if (!g_file_get_contents (pac, &pac_data, &len, &error)) { -- g_warning ("Could not read pac file: %s", error ? error->message : ""); -- return; -+ char *res; -+ -+ res = g_strdup_printf ("HTTP/1.0 %d %s\r\n\r\n" -+ "%d %s" -+ "%s", -+ error_code, reason, -+ error_code, reason, -+ reason); -+ g_output_stream_write_all (out, res, strlen (res), NULL, NULL, NULL); -+ g_free (res); -+} -+ -+static gboolean -+on_incoming (GSocketService *service, -+ GSocketConnection *connection, -+ GObject *source_object) -+{ -+ GOutputStream *out = NULL; -+ GInputStream *in = NULL; -+ g_autoptr (GDataInputStream) data = NULL; -+ g_autoptr (GFile) f = NULL; -+ g_autoptr (GError) error = NULL; -+ g_autoptr (GFileInputStream) file_in = NULL; -+ g_autoptr (GString) s = NULL; -+ g_autoptr (GFileInfo) info = NULL; -+ g_autofree char *line = NULL; -+ g_autofree char *unescaped = NULL; -+ g_autofree char *path = NULL; -+ char *escaped; -+ char *version; -+ char *tmp; -+ -+ in = g_io_stream_get_input_stream (G_IO_STREAM (connection)); -+ out = g_io_stream_get_output_stream (G_IO_STREAM (connection)); -+ -+ data = g_data_input_stream_new (in); -+ /* Be tolerant of input */ -+ g_data_input_stream_set_newline_type (data, G_DATA_STREAM_NEWLINE_TYPE_ANY); -+ -+ line = g_data_input_stream_read_line (data, NULL, NULL, NULL); -+ -+ if (line == NULL) { -+ send_error (out, 400, "Invalid request"); -+ goto out; -+ } -+ -+ if (!g_str_has_prefix (line, "GET ")) { -+ send_error (out, 501, "Only GET implemented"); -+ goto out; -+ } -+ -+ escaped = line + 4; /* Skip "GET " */ -+ -+ version = NULL; -+ tmp = strchr (escaped, ' '); -+ if (tmp == NULL) { -+ send_error (out, 400, "Bad Request"); -+ goto out; -+ } -+ *tmp = 0; -+ -+ version = tmp + 1; -+ if (!g_str_has_prefix (version, "HTTP/1.")) { -+ send_error(out, 505, "HTTP Version Not Supported"); -+ goto out; -+ } -+ -+ unescaped = g_uri_unescape_string (escaped, NULL); -+ path = g_test_build_filename (G_TEST_DIST, "data", unescaped, NULL); -+ f = g_file_new_for_path (path); -+ -+ error = NULL; -+ file_in = g_file_read (f, NULL, &error); -+ if (file_in == NULL) { -+ send_error (out, 404, error->message); -+ goto out; -+ } -+ -+ s = g_string_new ("HTTP/1.0 200 OK\r\n"); -+ -+ info = g_file_input_stream_query_info (file_in, -+ G_FILE_ATTRIBUTE_STANDARD_SIZE "," -+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, -+ NULL, NULL); -+ if (info) { -+ const char *content_type; -+ char *mime_type; -+ -+ if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SIZE)) -+ g_string_append_printf (s, "Content-Length: %"G_GINT64_FORMAT"\r\n", g_file_info_get_size (info)); -+ -+ if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)) { -+ content_type = g_file_info_get_content_type (info); -+ if (content_type) { -+ mime_type = g_content_type_get_mime_type (content_type); -+ if (mime_type) { -+ g_string_append_printf (s, "Content-Type: %s\r\n", mime_type); -+ g_free (mime_type); -+ } -+ } - } -- soup_server_message_set_response (msg, "text/plain", SOUP_MEMORY_COPY, pac_data, len); - } -+ g_string_append (s, "\r\n"); -+ -+ if (g_output_stream_write_all (out, s->str, s->len, NULL, NULL, NULL)) { -+ g_output_stream_splice (out, G_INPUT_STREAM (file_in), 0, NULL, NULL); -+ } -+ -+out: -+ return TRUE; - } - - static void -@@ -82,7 +175,7 @@ download_pac (gpointer data) - Fixture *self = data; - GBytes *pac; - -- pac = px_manager_pac_download (self->manager, "http://127.0.0.1:1983/test.pac"); -+ pac = px_manager_pac_download (self->manager, "http://127.0.0.1:1983/px-manager-sample.pac"); - g_assert_nonnull (pac); - - g_main_loop_quit (self->loop); -@@ -286,18 +379,18 @@ int - main (int argc, - char **argv) - { -- SoupServer *server = NULL; -+ g_autoptr (GSocketService) service = NULL; - g_autoptr (GError) error = NULL; - - g_test_init (&argc, &argv, NULL); - -- server = soup_server_new (NULL, NULL); -- if (!soup_server_listen_local (server, SERVER_PORT, SOUP_SERVER_LISTEN_IPV4_ONLY, &error)) { -- g_warning ("Could not create local server: %s", error ? error->message : ""); -+ service = g_socket_service_new (); -+ if (!g_socket_listener_add_inet_port (G_SOCKET_LISTENER (service), SERVER_PORT, NULL, &error)) { -+ g_error ("Could not create server socket: %s", error ? error->message : "?"); - return -1; - } - -- soup_server_add_handler (server, NULL, server_callback, NULL, NULL); -+ g_signal_connect (service, "incoming", G_CALLBACK (on_incoming), NULL); - - g_test_add ("/pac/download", Fixture, "px-manager-direct", fixture_setup, test_pac_download, fixture_teardown); - g_test_add ("/pac/get_proxies_direct", Fixture, "px-manager-direct", fixture_setup, test_get_proxies_direct, fixture_teardown); --- -2.40.1 - - -From 59b5306bba8419e118ff6eaab45ea6f735616db9 Mon Sep 17 00:00:00 2001 -From: Jan-Michael Brummer -Date: Mon, 22 May 2023 14:06:46 +0200 -Subject: [PATCH 6/7] Enforce online state for tests (#229) - -Fixes: https://github.com/libproxy/libproxy/issues/224 ---- - src/backend/px-manager.c | 22 +++++++++++++++++++--- - tests/px-manager-helper.c | 1 + - 2 files changed, 20 insertions(+), 3 deletions(-) - -diff --git a/src/backend/px-manager.c b/src/backend/px-manager.c -index 67a0b0f..3231aae 100644 ---- a/src/backend/px-manager.c -+++ b/src/backend/px-manager.c -@@ -66,6 +66,7 @@ enum { - PROP_0, - PROP_CONFIG_PLUGIN, - PROP_CONFIG_OPTION, -+ PROP_FORCE_ONLINE, - LAST_PROP - }; - -@@ -89,6 +90,7 @@ struct _PxManager { - char *config_plugin; - char *config_option; - -+ gboolean force_online; - gboolean online; - gboolean wpad; - GBytes *pac_data; -@@ -208,9 +210,14 @@ px_manager_constructed (GObject *object) - - self->pac_data = NULL; - -- self->network_monitor = g_network_monitor_get_default (); -- g_signal_connect_object (G_OBJECT (self->network_monitor), "network-changed", G_CALLBACK (px_manager_on_network_changed), self, 0); -- px_manager_on_network_changed (self->network_monitor, g_network_monitor_get_network_available (self->network_monitor), self); -+ if (!self->force_online) { -+ self->network_monitor = g_network_monitor_get_default (); -+ g_signal_connect_object (G_OBJECT (self->network_monitor), "network-changed", G_CALLBACK (px_manager_on_network_changed), self, 0); -+ px_manager_on_network_changed (self->network_monitor, g_network_monitor_get_network_available (self->network_monitor), self); -+ } else { -+ px_manager_on_network_changed (NULL, TRUE, self); -+ } -+ - g_debug ("%s: Up and running", __FUNCTION__); - } - -@@ -245,6 +252,9 @@ px_manager_set_property (GObject *object, - case PROP_CONFIG_OPTION: - self->config_option = g_strdup (g_value_get_string (value)); - break; -+ case PROP_FORCE_ONLINE: -+ self->force_online = g_value_get_boolean (value); -+ break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -@@ -287,6 +297,12 @@ px_manager_class_init (PxManagerClass *klass) - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); - -+ obj_properties[PROP_FORCE_ONLINE] = g_param_spec_boolean ("force-online", -+ NULL, -+ NULL, -+ FALSE, -+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); -+ - g_object_class_install_properties (object_class, LAST_PROP, obj_properties); - } - -diff --git a/tests/px-manager-helper.c b/tests/px-manager-helper.c -index e3129a2..10b43a2 100644 ---- a/tests/px-manager-helper.c -+++ b/tests/px-manager-helper.c -@@ -27,5 +27,6 @@ px_test_manager_new (const char *config_plugin, const char *config_option) - { - return px_manager_new_with_options ("config-plugin", config_plugin, - "config-option", config_option, -+ "force-online", TRUE, - NULL); - } --- -2.40.1 - - -From 4a4f54ca754689fb5a47dc7361e2530344ce82f5 Mon Sep 17 00:00:00 2001 -From: Jan-Michael Brummer -Date: Mon, 22 May 2023 17:24:02 +0200 -Subject: [PATCH 7/7] Use glib-object header instead of gio (#230) - -3rd party libraries (like QT) which defines same variable names will -clash if we use gio/gio.h in public proxy.h. Switch to minimal required -to fix compilation issues with QT5/6. - -Fixes: https://github.com/libproxy/libproxy/issues/226 ---- - src/libproxy/proxy.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/libproxy/proxy.h b/src/libproxy/proxy.h -index 1289f41..d24dc0f 100644 ---- a/src/libproxy/proxy.h -+++ b/src/libproxy/proxy.h -@@ -22,7 +22,7 @@ - - #pragma once - --#include -+#include - - #ifdef __cplusplus - extern "C" { --- -2.40.1 - diff --git a/libproxy.spec b/libproxy.spec index 40afbce..db08c83 100644 --- a/libproxy.spec +++ b/libproxy.spec @@ -3,7 +3,7 @@ %global __requires_exclude ^(%{_privatelibs})$ Name: libproxy -Version: 0.5.1 +Version: 0.5.2 Release: 1%{?dist} Summary: A library handling all the details of proxy configuration @@ -121,6 +121,9 @@ developing applications that use %{name}. %changelog +* Sun Jun 18 2023 David King - 0.5.2-1 +- Update to 0.5.2 + * Wed May 24 2023 David King - 0.5.1-1 - Update to 0.5.1 diff --git a/sources b/sources index 1c1e797..3f35e6a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (0.5.1.tar.gz) = 830e4bb1879c6afd1fbebc24de2ca75a597096a8eadb45dd3965b9f8121110039379342facebddce1b679a9b6ceb065089f0fbe38b55411a2c53ac36ef979ab7 +SHA512 (0.5.2.tar.gz) = 10d2d435288e8259bc16e6fc678bbd5edee7de8ef4235de29ed7740493690b33c3b1820f1a9befb60254069946e3ff3cc6130c7d19f34fff8062aec16dc1cbc8