diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 0b368196d27739e52494f59274687b119d9981bc..25249e9444ee620805829d0c9e744dd45cc1b5ad 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -533,7 +533,7 @@ void LLCurl::Easy::prepRequest(const std::string& url,
 	
 	if (post) setoptString(CURLOPT_ENCODING, "");
 
-	//setopt(CURLOPT_VERBOSE, 1); // usefull for debugging
+	//setopt(CURLOPT_VERBOSE, 1); // useful for debugging
 	setopt(CURLOPT_NOSIGNAL, 1);
 
 	// Set the CURL options for either Socks or HTTP proxy
@@ -546,7 +546,7 @@ void LLCurl::Easy::prepRequest(const std::string& url,
 		if (LLProxy::getInstance()->getHTTPProxyType() == LLPROXY_SOCKS)
 		{
 			setopt(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
-			if(LLProxy::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD)
+			if(LLProxy::getInstance()->getSelectedAuthMethod() == METHOD_PASSWORD)
 			{
 				setoptString(CURLOPT_PROXYUSERPWD, LLProxy::getInstance()->getProxyUserPwdCURL());
 			}
diff --git a/indra/llmessage/llpacketring.cpp b/indra/llmessage/llpacketring.cpp
index 91ab1df1495d7a063eb310d28f1ff3a5e6b23b66..a86b7b437033e9151a44d4baeb7c3eaa7a9ca3c2 100644
--- a/indra/llmessage/llpacketring.cpp
+++ b/indra/llmessage/llpacketring.cpp
@@ -227,13 +227,13 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap)
 		// no delay, pull straight from net
 		if (LLProxy::isEnabled())
 		{
-			U8 buffer[NET_BUFFER_SIZE];
+			U8 buffer[NET_BUFFER_SIZE + SOCKS_HEADER_SIZE];
 			packet_size = receive_packet(socket, reinterpret_cast<char *>(buffer));
 			
-			if (packet_size > 10)
+			if (packet_size > SOCKS_HEADER_SIZE)
 			{
 				// *FIX We are assuming ATYP is 0x01 (IPv4), not 0x03 (hostname) or 0x04 (IPv6)
-				memcpy(datap, buffer + 10, packet_size - 10);
+				memcpy(datap, buffer + SOCKS_HEADER_SIZE, packet_size - SOCKS_HEADER_SIZE);
 				proxywrap_t * header = reinterpret_cast<proxywrap_t *>(buffer);
 				mLastSender.setAddress(header->addr);
 				mLastSender.setPort(ntohs(header->port));
@@ -274,7 +274,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL
 	BOOL status = TRUE;
 	if (!mUseOutThrottle)
 	{
-		return doSendPacket(h_socket, send_buffer, buf_size, host );
+		return sendPacketImpl(h_socket, send_buffer, buf_size, host );
 	}
 	else
 	{
@@ -295,7 +295,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL
 				mOutBufferLength -= packetp->getSize();
 				packet_size = packetp->getSize();
 
-				status = doSendPacket(h_socket, packetp->getData(), packet_size, packetp->getHost());
+				status = sendPacketImpl(h_socket, packetp->getData(), packet_size, packetp->getHost());
 				
 				delete packetp;
 				// Update the throttle
@@ -304,7 +304,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL
 			else
 			{
 				// If the queue's empty, we can just send this packet right away.
-				status =  doSendPacket(h_socket, send_buffer, buf_size, host );
+				status =  sendPacketImpl(h_socket, send_buffer, buf_size, host );
 				packet_size = buf_size;
 
 				// Update the throttle
@@ -343,7 +343,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL
 	return status;
 }
 
-BOOL LLPacketRing::doSendPacket(int h_socket, const char * send_buffer, S32 buf_size, LLHost host)
+BOOL LLPacketRing::sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host)
 {
 	
 	if (!LLProxy::isEnabled())
@@ -351,14 +351,14 @@ BOOL LLPacketRing::doSendPacket(int h_socket, const char * send_buffer, S32 buf_
 		return send_packet(h_socket, send_buffer, buf_size, host.getAddress(), host.getPort());
 	}
 
-	proxywrap_t *socks_header = (proxywrap_t *)&mProxyWrappedSendBuffer;
+	proxywrap_t *socks_header = reinterpret_cast<proxywrap_t *>(&mProxyWrappedSendBuffer);
 	socks_header->rsv   = 0;
 	socks_header->addr  = host.getAddress();
 	socks_header->port  = htons(host.getPort());
 	socks_header->atype = ADDRESS_IPV4;
 	socks_header->frag  = 0;
 
-	memcpy(mProxyWrappedSendBuffer + 10, send_buffer, buf_size);
+	memcpy(mProxyWrappedSendBuffer + SOCKS_HEADER_SIZE, send_buffer, buf_size);
 
-	return send_packet(h_socket,(const char*) mProxyWrappedSendBuffer, buf_size + 10, LLProxy::getInstance()->getUDPProxy().getAddress(), LLProxy::getInstance()->getUDPProxy().getPort());
+	return send_packet(h_socket, (const char*) mProxyWrappedSendBuffer, buf_size + 10, LLProxy::getInstance()->getUDPProxy().getAddress(), LLProxy::getInstance()->getUDPProxy().getPort());
 }
diff --git a/indra/llmessage/llpacketring.h b/indra/llmessage/llpacketring.h
index 2fe2f8e1e947edef01655ecfc253748976045a86..7edcc834db83338ec72be7523a3607cb0e582a51 100644
--- a/indra/llmessage/llpacketring.h
+++ b/indra/llmessage/llpacketring.h
@@ -30,11 +30,11 @@
 
 #include <queue>
 
-#include "llpacketbuffer.h"
 #include "llhost.h"
-#include "net.h"
+#include "llpacketbuffer.h"
+#include "llproxy.h"
 #include "llthrottle.h"
-
+#include "net.h"
 
 class LLPacketRing
 {
@@ -83,8 +83,11 @@ class LLPacketRing
 	LLHost mLastSender;
 	LLHost mLastReceivingIF;
 
-	BOOL doSendPacket(int h_socket, const char * send_buffer, S32 buf_size, LLHost host);
-	U8 mProxyWrappedSendBuffer[NET_BUFFER_SIZE];
+
+	U8 mProxyWrappedSendBuffer[NET_BUFFER_SIZE + SOCKS_HEADER_SIZE];
+
+private:
+	BOOL sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host);
 };
 
 
diff --git a/indra/llmessage/llproxy.h b/indra/llmessage/llproxy.h
index 498ffce24e24fdd4c52af13b5bc7817de61f3684..7893545b9d646f70ba549fcd2d006a5b632810ce 100644
--- a/indra/llmessage/llproxy.h
+++ b/indra/llmessage/llproxy.h
@@ -49,6 +49,8 @@
 
 #define SOCKS_VERSION 0x05 // we are using SOCKS 5
 
+#define SOCKS_HEADER_SIZE 10
+
 // SOCKS 5 address/hostname types
 #define ADDRESS_IPV4     0x01
 #define ADDRESS_HOSTNAME 0x03
@@ -139,7 +141,7 @@ struct proxywrap_t {
 #pragma pack(pop) /* restore original alignment from stack */
 
 
-// Currently selected http proxy type
+// Currently selected HTTP proxy type
 enum LLHttpProxyType
 {
 	LLPROXY_SOCKS = 0,