break;
if(!c->node) {
- if(proxytype == PROXY_SOCKS4 && c->allow_request == ID) {
+ if(c->outgoing && proxytype == PROXY_SOCKS4 && c->allow_request == ID) {
if(tcpbuffer[0] == 0 && tcpbuffer[1] == 0x5a) {
logger(DEBUG_CONNECTIONS, LOG_DEBUG, "Proxy request granted");
} else {
logger(DEBUG_CONNECTIONS, LOG_ERR, "Proxy request rejected");
return false;
}
- } else if(proxytype == PROXY_SOCKS5 && c->allow_request == ID) {
+ } else if(c->outgoing && proxytype == PROXY_SOCKS5 && c->allow_request == ID) {
if(tcpbuffer[0] != 5) {
logger(DEBUG_CONNECTIONS, LOG_ERR, "Invalid response from proxy server");
return false;
void finish_connecting(connection_t *c) {
logger(DEBUG_CONNECTIONS, LOG_INFO, "Connected to %s (%s)", c->name, c->hostname);
- if(proxytype != PROXY_EXEC)
- configure_tcp(c);
-
c->last_ping_time = time(NULL);
c->status.connecting = false;
}
logger(DEBUG_CONNECTIONS, LOG_INFO, "Using proxy at %s port %s", proxyhost, proxyport);
c->socket = socket(proxyai->ai_family, SOCK_STREAM, IPPROTO_TCP);
+ configure_tcp(c);
}
if(c->socket == -1) {
}
bool receive_request(connection_t *c, const char *request) {
- if(proxytype == PROXY_HTTP && c->allow_request == ID) {
+ if(c->outgoing && proxytype == PROXY_HTTP && c->allow_request == ID) {
if(!request[0] || request[0] == '\r')
return true;
if(!strncasecmp(request, "HTTP/1.1 ", 9)) {
minor = myself->connection->protocol_minor;
}
- if(proxytype)
+ if(proxytype && c->outgoing)
if(!send_proxyrequest(c))
return false;