diff options
author | Daniel Stenberg <daniel@haxx.se> | 2011-04-20 15:17:42 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-04-27 09:09:35 +0200 |
commit | b903186fa0189ff241d756d25d07fdfe9885ae49 (patch) | |
tree | bd942ac8753469172661b0d30153986378337fdf /lib/socks.c | |
parent | 592eda8e3feb1bf8d0f85c2baa485323b315f9d9 (diff) | |
download | curl-b903186fa0189ff241d756d25d07fdfe9885ae49.tar.gz |
source cleanup: unify look, style and indent levels
By the use of a the new lib/checksrc.pl script that checks that our
basic source style rules are followed.
Diffstat (limited to 'lib/socks.c')
-rw-r--r-- | lib/socks.c | 25 |
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); |