Proxy Support

Proxy Support — Functions for determining proxy support.

Synopsis




enum        GNetworkTcpProxyType;
gboolean    gnetwork_tcp_proxy_get_use_proxy
                                            (GNetworkTcpProxyType type,
                                             const gchar *address);

Description

The GNetwork library automatically forwards outgoing connections through configured proxy servers. The configuration is stored in GConf, and GNetwork reads the same configuration as GnomeVFS, and by extension, the GNOME Desktop.

The GConf keys used to store proxy settings are:

Key Type Description
/system/http_proxy/use_http_proxy Boolean Use a proxy server to connect to HTTP servers.
/system/http_proxy/host String The hostname of the HTTP proxy server.
/system/http_proxy/port Integer The port of the HTTP proxy server defined in /system/http_proxy/host.
/system/http_proxy/use_authentication Boolean Authenticate when using the HTTP proxy server.
/system/http_proxy/authentication_user String The username to use when authenticating with the HTTP proxy server defined in /system/http_proxy/host.
/system/http_proxy/authentication_password String The password to use when authenticating with the HTTP proxy server defined in /system/http_proxy/host.
/system/http_proxy/ignore_hosts String List Which hostnames to always connect to directly.
/system/proxy/ftp_host String The hostname of the FTP proxy server.
/system/proxy/ftp_port Integer The port of the FTP proxy server defined in /system/proxy/ftp_host.
/system/proxy/secure_host String The hostname of the SSL proxy server.
/system/proxy/secure_port Integer The port of the SSL proxy server defined in /system/proxy/secure_host.
/system/proxy/socks_host String The hostname of the SOCKS proxy server.
/system/proxy/socks_port Integer The port of the SOCKS proxy server defined in /system/proxy/socks_host.
/system/proxy/socks_version Integer The version of the SOCKS proxy server defined in /system/proxy/socks_host.

Details

enum GNetworkTcpProxyType

typedef enum			/* < prefix=GNETWORK_TCP_PROXY > */
{
  GNETWORK_TCP_PROXY_HTTP,
  GNETWORK_TCP_PROXY_HTTPS,
  GNETWORK_TCP_PROXY_FTP,
  GNETWORK_TCP_PROXY_SOCKS,

  GNETWORK_TCP_PROXY_NONE
}
GNetworkTcpProxyType;

An enumeration of the supported proxy types.

GNETWORK_TCP_PROXY_HTTP a generic proxy server intended for HTTP connections.
GNETWORK_TCP_PROXY_HTTPS a generic proxy server intended for secure HTTP connections.
GNETWORK_TCP_PROXY_FTP a proxy for FTP connections
GNETWORK_TCP_PROXY_SOCKS a proxy for all other connections
GNETWORK_TCP_PROXY_NONE no proxy (should not be used).

gnetwork_tcp_proxy_get_use_proxy ()

gboolean    gnetwork_tcp_proxy_get_use_proxy
                                            (GNetworkTcpProxyType type,
                                             const gchar *address);

This function checks type and address, and returns TRUE if a proxy will be used, or FALSE, if one won't. This is useful if you need to check to see if you can create a GNetworkServer without problems.

type : the type of proxy for this connection.
address : the remote address to check the proxy for.
Returns : a gboolean if a proxy will be used for this connection.

Since 1.0