fixed proxy init

This commit is contained in:
csoler 2022-01-09 17:06:10 +01:00
parent 2456dbb2a0
commit e7eb606a4a
2 changed files with 21 additions and 19 deletions

View File

@ -20,6 +20,8 @@ int pqiproxyconnection::proxy_negotiate_connection(int sockfd)
case PROXY_STATE_WAITING_SOCKS_RESPONSE:
ret = Proxy_Connection_Complete(sockfd); // wait for ACK.
if(ret < 1)
break;
case PROXY_STATE_CONNECTION_COMPLETE:
@ -41,6 +43,8 @@ int pqiproxyconnection::proxy_negotiate_connection(int sockfd)
return -1;
}
if(ret < 0)
return -1;
#ifdef PROXY_DEBUG
std::cerr << "pqisslproxy::Basic_Connection_Complete() IN PROGRESS";
@ -225,8 +229,8 @@ int pqiproxyconnection::Proxy_Send_Address(int sockfd)
return ret; // Method Response not complete.
}
char socks_request[MAX_SOCKS_REQUEST_LEN] =
{ 0x05, // SOCKS VERSION.
char socks_request[MAX_SOCKS_REQUEST_LEN] = {
0x05, // SOCKS VERSION.
0x01, // CONNECT (Tor doesn't support BIND or UDP).
0x00, // RESERVED.
0x03, // ADDRESS TYPE (Domain Name)
@ -237,9 +241,7 @@ int pqiproxyconnection::Proxy_Send_Address(int sockfd)
uint8_t len = mDomainAddress.length();
socks_request[4] = len;
for(int i = 0; i < len; i++)
{
socks_request[5 + i] = mDomainAddress[i];
}
/* now add the port, being careful with packing */
uint16_t net_port = htons(mRemotePort);