| 207 | |
| 208 | |
| 209 | void * proxychild(struct clientparam* param) { |
| 210 | int res=0, i=0; |
| 211 | unsigned char* buf = NULL, *newbuf; |
| 212 | int inbuf; |
| 213 | int bufsize; |
| 214 | unsigned reqlen = 0; |
| 215 | unsigned char *sb=NULL, *sg=NULL, *se=NULL, *sp=NULL, |
| 216 | *req=NULL, *su=NULL, *ss = NULL; |
| 217 | unsigned char *ftpbase=NULL; |
| 218 | unsigned char username[1024]; |
| 219 | int keepalive = 0; |
| 220 | uint64_t contentlength64 = 0; |
| 221 | int hascontent =0; |
| 222 | int isconnect = 0; |
| 223 | int redirect = 0; |
| 224 | int prefix = 0, ckeepalive=0; |
| 225 | int ftp = 0; |
| 226 | int anonymous; |
| 227 | int sleeptime = 0; |
| 228 | int reqsize, reqbufsize; |
| 229 | int authenticate; |
| 230 | struct pollfd fds[2]; |
| 231 | SOCKET ftps; |
| 232 | char ftpbuf[FTPBUFSIZE]; |
| 233 | int inftpbuf = 0; |
| 234 | #ifndef WITHMAIN |
| 235 | FILTER_ACTION action; |
| 236 | #endif |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | if(!(buf = myalloc(BUFSIZE))) {RETURN(21);} |
| 242 | bufsize = BUFSIZE; |
| 243 | anonymous = param->srv->singlepacket; |
| 244 | for(;;){ |
| 245 | memset(buf, 0, bufsize); |
| 246 | inbuf = 0; |
| 247 | |
| 248 | |
| 249 | if(keepalive && (param->cliinbuf == param->clioffset) && (param->remsock != INVALID_SOCKET)){ |
| 250 | memset(fds, 0, sizeof(fds)); |
| 251 | fds[0].fd = param->clisock; |
| 252 | fds[0].events = POLLIN; |
| 253 | fds[1].fd = param->remsock; |
| 254 | fds[1].events = POLLIN; |
| 255 | res = so._poll(fds, 2, conf.timeouts[STRING_S]*1000); |
| 256 | if(res<=0) { |
| 257 | RETURN(555); |
| 258 | } |
| 259 | if((fds[1].revents & (POLLIN|POLLHUP|POLLERR|POLLNVAL))) { |
| 260 | if(param->transparent || (!param->redirected && param->redirtype == R_HTTP)) RETURN(555); |
| 261 | ckeepalive = 0; |
| 262 | so._shutdown(param->remsock, SHUT_RDWR); |
| 263 | so._closesocket(param->remsock); |
| 264 | param->remsock = INVALID_SOCKET; |
| 265 | param->redirected = 0; |
| 266 | param->redirtype = 0; |
nothing calls this directly
no test coverage detected