From 9caed63b2159a99853958ace42deac61464fce47 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 15 Apr 2016 10:23:31 +0100 Subject: [PATCH] socks5 set buffering before encoding --- src/core/network-proxy-socks5.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/network-proxy-socks5.c b/src/core/network-proxy-socks5.c index 739583c4..41b3c9f0 100644 --- a/src/core/network-proxy-socks5.c +++ b/src/core/network-proxy-socks5.c @@ -135,7 +135,6 @@ static bool socks5_connect(const struct network_proxy_socks5 *proxy, GIOChannel struct server_greeting s_greeting; struct server_response s_response; - /* Phase 1: exchange greeting */ { struct client_greeting c_greeting = { @@ -290,12 +289,11 @@ static GIOChannel *network_proxy_socks5_connect(struct network_proxy const *prox old_flags = g_io_channel_get_flags(ch); old_buf = g_io_channel_get_buffered(ch); + g_io_channel_set_buffered(ch, true); if (g_io_channel_set_encoding(ch, NULL, &err)!=G_IO_STATUS_NORMAL || g_io_channel_set_flags(ch, old_flags & ~G_IO_FLAG_NONBLOCK, &err)!=G_IO_STATUS_NORMAL) goto err; - g_io_channel_set_buffered(ch, false); - if (!socks5_connect(self, ch, address, port)) goto err;