mirror of
https://github.com/irssi/irssi.git
synced 2026-08-24 11:02:21 +02:00
PROXY: implemented native proxy support
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:
parent
3d6051a03e
commit
0236ee5eaa
12 changed files with 297 additions and 48 deletions
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "module.h"
|
||||
#include "network.h"
|
||||
#include "network-proxy.h"
|
||||
|
||||
#include <sys/un.h>
|
||||
|
||||
|
|
@ -169,7 +170,7 @@ GIOChannel *net_connect(const char *addr, int port, IPADDR *my_ip)
|
|||
}
|
||||
|
||||
/* Connect to socket with ip address */
|
||||
GIOChannel *net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip)
|
||||
GIOChannel *net_connect_ip(IPADDR const *ip, int port, IPADDR *my_ip)
|
||||
{
|
||||
union sockaddr_union so;
|
||||
int handle, ret, opt = 1;
|
||||
|
|
@ -226,6 +227,18 @@ GIOChannel *net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip)
|
|||
return g_io_channel_new(handle);
|
||||
}
|
||||
|
||||
/* Connect to socket */
|
||||
GIOChannel *net_connect_proxy(struct network_proxy const *proxy,
|
||||
char const *host, int port, IPADDR *ip, IPADDR *my_ip)
|
||||
{
|
||||
|
||||
if (proxy)
|
||||
return proxy->connect(proxy, ip, host, port);
|
||||
else
|
||||
return net_connect_ip(ip, port, my_ip);
|
||||
}
|
||||
|
||||
|
||||
/* Connect to named UNIX socket */
|
||||
GIOChannel *net_connect_unix(const char *path)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue