# HG changeset patch # User Eric Warmenhoven # Date 980928479 0 # Node ID f6cc5cb7faf6ce57beca5b68842421c7cbbf3ec8 # Parent 024f9250ba63c7085cc02c529d04b54d5291a8e4 [gaim-migrate @ 1461] patch from customdesigned to hopefully fix proxying once and for all. committer: Tailor Script diff -r 024f9250ba63 -r f6cc5cb7faf6 src/proxy.c --- a/src/proxy.c Wed Jan 31 07:36:01 2001 +0000 +++ b/src/proxy.c Wed Jan 31 08:07:59 2001 +0000 @@ -195,8 +195,8 @@ packet[0] = 4; packet[1] = 1; - packet[2] = (((unsigned short)htons(port)) >> 8); - packet[3] = (((unsigned short)htons(port)) & 0xff); + packet[2] = port >> 8; + packet[3] = port & 0xff; packet[4] = (unsigned char)(hp->h_addr_list[0])[0]; packet[5] = (unsigned char)(hp->h_addr_list[0])[1]; packet[6] = (unsigned char)(hp->h_addr_list[0])[2]; @@ -219,6 +219,7 @@ unsigned char buf[512]; struct sockaddr_in sin; struct hostent *hp; + int hlen = strlen(host); debug_printf("connecting to %s:%d via %s:%d using SOCKS5\n", host, port, proxyhost, proxyport); @@ -263,10 +264,10 @@ buf[1] = 0x01; /* CONNECT */ buf[2] = 0x00; /* reserved */ buf[3] = 0x03; /* address type -- host name */ - buf[4] = strlen(host); - memcpy(buf + 5, host, strlen(host)); - buf[5 + strlen(host)] = htons(port) >> 8; - buf[5 + strlen(host) + 1] = htons(port) & 0xff; + buf[4] = hlen; + memcpy(buf + 5, host, hlen); + buf[5 + strlen(host)] = port >> 8; + buf[5 + strlen(host) + 1] = port & 0xff; if (write(fd, buf, (5 + strlen(host) + 2)) < (5 + strlen(host) + 2)) { close(fd);