mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 18:45:40 +08:00
potential memory leak fixed + TCP_CORK support
potential memleak fixed in very unlikely configuration TCP_CORK used to prevent sending request apart of headers
This commit is contained in:
parent
39be30ba5d
commit
de21bd0f6a
18
src/proxy.c
18
src/proxy.c
@ -802,9 +802,13 @@ for(;;){
|
||||
|
||||
if(isconnect && param->redirtype != R_HTTP) {
|
||||
socksend(param->clisock, (unsigned char *)proxy_stringtable[8], (int)strlen(proxy_stringtable[8]), conf.timeouts[STRING_S]);
|
||||
if(param->redirectfunc) return (*param->redirectfunc)(param);
|
||||
if(param->redirectfunc) {
|
||||
if(req)myfree(req);
|
||||
if(buf)myfree(buf);
|
||||
|
||||
return (*param->redirectfunc)(param);
|
||||
}
|
||||
param->res = mapsocket(param, conf.timeouts[CONNECTION_L]);
|
||||
if(param->redirectfunc) return (*param->redirectfunc)(param);
|
||||
RETURN(param->res);
|
||||
}
|
||||
|
||||
@ -813,6 +817,10 @@ for(;;){
|
||||
}
|
||||
|
||||
else {
|
||||
#ifdef TCP_CORK
|
||||
int opt = 1;
|
||||
so._setsockopt(param->remsock, IPPROTO_TCP, TCP_CORK, (unsigned char *)&opt, sizeof(int));
|
||||
#endif
|
||||
redirect = 1;
|
||||
res = (int)strlen((char *)req);
|
||||
if(socksend(param->remsock, req , res, conf.timeouts[STRING_L]) != res) {
|
||||
@ -860,6 +868,12 @@ for(;;){
|
||||
if ((res = socksend(param->remsock, buf+reqlen, (int)strlen((char *)buf+reqlen), conf.timeouts[STRING_S])) != (int)strlen((char *)buf+reqlen)) {
|
||||
RETURN(518);
|
||||
}
|
||||
#ifdef TCP_CORK
|
||||
{
|
||||
int opt = 0;
|
||||
so._setsockopt(param->remsock, IPPROTO_TCP, TCP_CORK, (unsigned char *)&opt, sizeof(int));
|
||||
}
|
||||
#endif
|
||||
param->statscli64 += res;
|
||||
param->nwrites++;
|
||||
if(param->bandlimfunc) {
|
||||
|
Loading…
Reference in New Issue
Block a user