PROXY: implemented native proxy support

For the original patch by Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 26 Feb 2008

This patch creates a hook into the net_connect*() methods which call a
method to connect to a proxy.

Previous solution to send certain strings in the normal IRC dialog was
some kind of hack as most proxies require some kind of negotation.

E.g. HTTP proxies sent a 'HTTP/1.0 200 Connection established' HTTP header
and clients have to wait for it.  Else, sent bytes of the following IRC
login will be dropped silently.

With old method, it is also impossible to tunnel SSL IRC connections
through the proxy as proxy speaks plain text or a special protocol while
e.g. 'CONNECT ... HTTP/1.0' will be encrypted with key of IRC server.

There are further enhancements possible: the whole net_connect stuff
should be made asynchronously. Currently, only the hostname is resolved
in the background (which makes little sense of local proxies usually).
This commit is contained in:
Bob Mottram 2016-04-14 10:57:46 +01:00
commit c79aae7824
11 changed files with 267 additions and 48 deletions

View file

@ -29,6 +29,7 @@
#include "servers-reconnect.h"
#include "settings.h"
#include "network-proxy.h"
GSList *reconnects;
static int last_reconnect_tag;
@ -157,11 +158,7 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info)
server_connect_ref(dest);
dest->type = module_get_uniq_id("SERVER CONNECT", 0);
dest->reconnection = src->reconnection;
dest->proxy = g_strdup(src->proxy);
dest->proxy_port = src->proxy_port;
dest->proxy_string = g_strdup(src->proxy_string);
dest->proxy_string_after = g_strdup(src->proxy_string_after);
dest->proxy_password = g_strdup(src->proxy_password);
dest->proxy = src->proxy ? src->proxy->clone(src->proxy) : NULL;
dest->tag = g_strdup(src->tag);