aboutsummaryrefslogtreecommitdiff
path: root/lib/socks.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/socks.c')
-rw-r--r--lib/socks.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/socks.c b/lib/socks.c
index 5424d54af..14f8a2db2 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -163,7 +163,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
*((unsigned short*)&socksreq[2]) = htons((unsigned short)remote_port);
/* DNS resolve only for SOCKS4, not SOCKS4a */
- if (!protocol4a) {
+ if(!protocol4a) {
struct Curl_dns_entry *dns;
Curl_addrinfo *hp=NULL;
int rc;
@@ -227,14 +227,14 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
(int)strlen((char*)socksreq + 8); /* size including NUL */
/* If SOCKS4a, set special invalid IP address 0.0.0.x */
- if (protocol4a) {
+ if(protocol4a) {
socksreq[4] = 0;
socksreq[5] = 0;
socksreq[6] = 0;
socksreq[7] = 1;
/* If still enough room in buffer, also append hostname */
hostnamelen = (ssize_t)strlen(hostname) + 1; /* length including NUL */
- if (packetsize + hostnamelen <= SOCKS4REQLEN)
+ if(packetsize + hostnamelen <= SOCKS4REQLEN)
strcpy((char*)socksreq + packetsize, hostname);
else
hostnamelen = 0; /* Flag: hostname did not fit in buffer */
@@ -248,7 +248,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
failf(data, "Failed to send SOCKS4 connect request.");
return CURLE_COULDNT_CONNECT;
}
- if (protocol4a && hostnamelen == 0) {
+ if(protocol4a && hostnamelen == 0) {
/* SOCKS4a with very long hostname - send that name separately */
hostnamelen = (ssize_t)strlen(hostname) + 1;
code = Curl_write_plain(conn, sock, (char *)hostname, hostnamelen,
@@ -296,10 +296,9 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
}
/* Result */
- switch(socksreq[1])
- {
+ switch(socksreq[1]) {
case 90:
- if (protocol4a)
+ if(protocol4a)
infof(data, "SOCKS4a request granted.\n");
else
infof(data, "SOCKS4 request granted.\n");
@@ -391,8 +390,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
ssize_t packetsize = 0;
/* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */
- if(!socks5_resolve_local && hostname_len > 255)
- {
+ if(!socks5_resolve_local && hostname_len > 255) {
infof(conn->data,"SOCKS5: server resolving disabled for hostnames of "
"length > 255 [actual len=%zu]\n", hostname_len);
socks5_resolve_local = TRUE;
@@ -643,9 +641,11 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
if(conn->socks5_gssapi_enctype) {
failf(data, "SOCKS5 gssapi protection not yet implemented.");
- } else
+ }
+ else
#endif
- code = Curl_write_plain(conn, sock, (char *)socksreq, packetsize, &written);
+ code = Curl_write_plain(conn, sock, (char *)socksreq, packetsize,
+ &written);
if((code != CURLE_OK) || (written != packetsize)) {
failf(data, "Failed to send SOCKS5 connect request.");
return CURLE_COULDNT_CONNECT;
@@ -656,7 +656,8 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
if(conn->socks5_gssapi_enctype) {
failf(data, "SOCKS5 gssapi protection not yet implemented.");
- } else
+ }
+ else
#endif
result = Curl_blockread_all(conn, sock, (char *)socksreq, packetsize,
&actualread, timeout);