### Install Fedora Build Source: https://libproxy.github.io/libproxy/build-steps.html Installs the compiled libproxy on Fedora using Ninja. ```bash ninja -C build install ``` -------------------------------- ### Python Libproxy Example Source: https://libproxy.github.io/libproxy/python.html Use this snippet to get proxy settings for a URL and test connectivity. Requires the 'requests' library and gi.repository.Libproxy. ```python import gi gi.require_version('Libproxy', '1.0') from gi.repository import Libproxy import requests url = 'https://github.com/libproxy/libproxy' pf = Libproxy.ProxyFactory() proxies = pf.get_proxies(url) success = False for proxy in proxies: response = requests.get(url) #, proxies=proxies) if response.status_code == 200: success = True break if success: print(f"The requested URL {url} could be retrieved using the current setup!") else: print(f"The requested URL {url} could *NOT* be retrieved using the current setup") ``` -------------------------------- ### Setup Fedora Build Source: https://libproxy.github.io/libproxy/build-steps.html Initializes the build environment for libproxy on Fedora using Meson. ```bash meson setup build ``` -------------------------------- ### Install Fedora Dependencies Source: https://libproxy.github.io/libproxy/build-steps.html Installs necessary development libraries and tools for building libproxy on Fedora using dnf. ```bash sudo dnf install glib2-devel duktape-devel meson gcovr gi-docgen libcurl-devel vala gsettings-desktop-schemas-devel gobject-introspection-devel ``` -------------------------------- ### Install OS X Dependencies Source: https://libproxy.github.io/libproxy/build-steps.html Installs necessary build tools and libraries for libproxy on OS X using pip and brew. ```bash pip install meson ninja brew install icu4c gobject-introspection duktape gcovr gi-docgen curl vala ``` -------------------------------- ### Proxy retrieval in Vala Source: https://libproxy.github.io/libproxy/vala.html Example demonstrating how to instantiate a ProxyFactory and retrieve proxy settings for a specific URL. ```Vala using px; void main() { var pf = new px.ProxyFactory(); string[] proxies = pf.get_proxies("https://github.com/libproxy/libproxy"); foreach (string proxy in proxies) { stdout.printf ("%s\n", proxy); } } ``` -------------------------------- ### Install Windows (MSYS2) Dependencies Source: https://libproxy.github.io/libproxy/build-steps.html Installs necessary development tools and libraries for libproxy on Windows using MSYS2's pacman. ```bash pacman -S base-devel git mingw-w64-x86_64-toolchain mingw-w64-x86_64-ccache mingw-w64-x86_64-pkg-config mingw-w64-x86_64-gobject-introspection mingw-w64-x86_64-python-gobject mingw-w64-x86_64-meson mingw-w64-x86_64-glib2 mingw-w64-x86_64-duktape mingw-w64-x86_64-gi-docgen mingw-w64-x86_64-curl mingw-w64-x86_64-vala mingw-w64-x86_64-gsettings-desktop-schemas ``` -------------------------------- ### Retrieve proxy settings in Ruby Source: https://libproxy.github.io/libproxy/ruby.html Initializes a ProxyFactory and iterates through available proxies for a given URL. Ensure the gir_ffi gem is installed and the libproxy GObject Introspection data is available. ```ruby #!/usr/bin/ruby require 'gir_ffi' GirFFI.setup :Libproxy pf = Libproxy::ProxyFactory.new() proxies = pf.get_proxies("https://github.com/libproxy/libproxy") proxies.each do |proxy| puts proxy end pf.free() ``` -------------------------------- ### Get Proxies in Perl Source: https://libproxy.github.io/libproxy/perl.html Use this snippet to retrieve proxy information for a given URL in Perl. Ensure Glib::Object::Introspection is set up correctly. ```perl #!/usr/bin/perl use warnings; use Glib::Object::Introspection; Glib::Object::Introspection->setup( basename => 'Px', version => '1.0', package => 'Px'); my $pf = new Px::ProxyFactory; $proxies = $pf->get_proxies("https://github.com/libproxy/libproxy"); foreach my $proxy (@$proxies) { print $proxy."\n"; } ``` -------------------------------- ### Compile Fedora Build Source: https://libproxy.github.io/libproxy/build-steps.html Compiles the libproxy project on Fedora using Ninja. ```bash ninja -C build ``` -------------------------------- ### Create a new pxProxyFactory instance Source: https://libproxy.github.io/libproxy/ctor.ProxyFactory.new.html Call this function to create a new pxProxyFactory. Retain the instance for performance as it caches data. The caller is responsible for freeing the memory. ```c pxProxyFactory* px_proxy_factory_new ( void ) ``` -------------------------------- ### Makefile for Vala libproxy project Source: https://libproxy.github.io/libproxy/vala.html Build configuration for compiling a Vala application that depends on libproxy-1.0. ```Makefile all: sample sample: sample.vala valac --pkg libproxy-1.0 sample.vala clean: rm sample ``` -------------------------------- ### Firefox/Chromium Proxy Logic (GNOME) Source: https://libproxy.github.io/libproxy/configuration-logic.html When not using the same proxy for all protocols, this logic prioritizes SOCKS proxies, then protocol-specific proxies. If a single proxy is set for all protocols, it's used. Direct connection is the final fallback. ```pseudocode IF not using same proxy for all protocols THEN IF SOCKS is set THEN use it ELSE IF protocol specific proxy is set THEN use it ELSE IF using same proxy for all protocols THEN IF SOCKS is set THEN use it IF no proxy has been set THEN use direct connection ``` -------------------------------- ### px_proxy_factory_new Source: https://libproxy.github.io/libproxy/struct.ProxyFactory.html Creates a new instance of the pxProxyFactory struct. ```APIDOC ## Constructor: px_proxy_factory_new ### Description Creates a new `pxProxyFactory` instance. ### Since 1.0 ``` -------------------------------- ### px_proxy_factory_new Source: https://libproxy.github.io/libproxy/ctor.ProxyFactory.new.html Creates a new pxProxyFactory instance. This instance should be kept around as long as possible as it contains cached data to increase performance. Memory usage should be minimal (cache is small) and the cache lifespan is handled automatically. ```APIDOC ## px_proxy_factory_new ### Description Creates a new `pxProxyFactory` instance. This instance should be kept around as long as possible as it contains cached data to increase performance. Memory usage should be minimal (cache is small) and the cache lifespan is handled automatically. ### Method N/A (This is a factory function, not a typical HTTP method) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **pxProxyFactory** (pointer) - The newly created `pxProxyFactory` instance. #### Response Example ```c pxProxyFactory* factory = px_proxy_factory_new(); // Use the factory... // Remember to free the factory when done // px_proxy_factory_free(factory); ``` ### Return Value - **pxProxyFactory** (pointer): A pointer to the newly created `pxProxyFactory` instance. The caller is responsible for freeing this memory. ``` -------------------------------- ### Safari Proxy Logic (OS X) Source: https://libproxy.github.io/libproxy/configuration-logic.html Safari attempts to connect through configured proxies in a specific order: protocol-specific, then SOCKS, then PAC auto-configuration. It tries each proxy until a connection is established, offering a more resilient approach. ```pseudocode DEFINE proxy_list as list IF protocol specific proxy is set THEN add it to proxy_list IF SOCKS proxy is set THEN append it to proxy_list IF PAC auto-configuration is set THEN append it to proxy_list FOREACH proxy in proxy_list connect to proxy IF connection failed THEN continue ELSE stop ``` -------------------------------- ### px_proxy_factory_get_proxies Source: https://libproxy.github.io/libproxy/struct.ProxyFactory.html Retrieves the list of proxies to use for a given URL. ```APIDOC ## Method: px_proxy_factory_get_proxies ### Description Get which proxies to use for the specified URL. ### Since 1.0 ``` -------------------------------- ### Firefox Proxy Logic (Linux) Source: https://libproxy.github.io/libproxy/configuration-logic.html On Linux, Firefox prioritizes protocol-specific proxies over SOCKS proxies. If a protocol-specific proxy is set, it's used; otherwise, a SOCKS proxy is used if available. Direct connection is the fallback. ```pseudocode IF protocol specific proxy is set THEN use it ELSE IF SOCKS proxy is set THEN use it ELSE use direct connection. ``` -------------------------------- ### px_proxy_factory_free Source: https://libproxy.github.io/libproxy/method.ProxyFactory.free.html Frees the memory associated with a pxProxyFactory instance. ```APIDOC ## void px_proxy_factory_free(pxProxyFactory* self) ### Description Frees the pxProxyFactory instance and releases associated resources. ### Parameters #### Path Parameters - **self** (pxProxyFactory*) - Required - The proxy factory instance to be freed. ``` -------------------------------- ### px_proxy_factory_free_proxies Source: https://libproxy.github.io/libproxy/struct.ProxyFactory.html Frees the memory associated with the proxy array. ```APIDOC ## Function: px_proxy_factory_free_proxies ### Description Frees the proxy array returned by `px_proxy_factory_get_proxies` when no longer used. ### Since 1.0 ``` -------------------------------- ### Free Proxy Array Source: https://libproxy.github.io/libproxy/type_func.ProxyFactory.free_proxies.html Frees the proxy array obtained from px_proxy_factory_get_proxies. ```APIDOC ## void px_proxy_factory_free_proxies (char** proxies) ### Description Frees the proxy array returned by `px_proxy_factory_get_proxies` when no longer used. ### Method N/A (C Function) ### Endpoint N/A (C Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (void) This function does not return a value. #### Response Example None ``` -------------------------------- ### Free Proxy Array - C Source: https://libproxy.github.io/libproxy/type_func.ProxyFactory.free_proxies.html Frees the proxy array returned by px_proxy_factory_get_proxies. The array must be NULL-terminated. Since 0.4.16. ```c void px_proxy_factory_free_proxies ( char** proxies ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.