|
|
|
@ -459,6 +459,7 @@ static char *proxyauth(const char *user, const char *pass) |
|
|
|
|
buf[len] = '\0'; |
|
|
|
|
auth = malloc(strlen(buf) + 30); |
|
|
|
|
if(!auth) { |
|
|
|
|
free(buf); |
|
|
|
|
logg("!proxyauth: Can't allocate memory for 'authorization'\n"); |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
@ -490,10 +491,12 @@ static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, cha |
|
|
|
|
|
|
|
|
|
if(user) { |
|
|
|
|
authorization = proxyauth(user, pass); |
|
|
|
|
if(!authorization) |
|
|
|
|
if(!authorization) { |
|
|
|
|
free(remotename); |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(stat(file, &sb) != -1 && sb.st_mtime < time(NULL)) { |
|
|
|
|
Rfc2822DateTime(last_modified, sb.st_mtime); |
|
|
|
@ -652,10 +655,12 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna |
|
|
|
|
|
|
|
|
|
if(user) { |
|
|
|
|
authorization = proxyauth(user, pass); |
|
|
|
|
if(!authorization) |
|
|
|
|
if(!authorization) { |
|
|
|
|
free(remotename); |
|
|
|
|
return 75; /* FIXME */ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(uas) |
|
|
|
|
strncpy(uastr, uas, sizeof(uastr)); |
|
|
|
@ -673,6 +678,12 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna |
|
|
|
|
"Connection: close\r\n" |
|
|
|
|
"\r\n", (remotename != NULL) ? remotename : "", srcfile, hostname, (authorization != NULL) ? authorization : "", uastr); |
|
|
|
|
|
|
|
|
|
if(remotename) |
|
|
|
|
free(remotename); |
|
|
|
|
|
|
|
|
|
if(authorization) |
|
|
|
|
free(authorization); |
|
|
|
|
|
|
|
|
|
memset(ipaddr, 0, sizeof(ipaddr)); |
|
|
|
|
if(ip[0]) /* use ip to connect */ |
|
|
|
|
sd = wwwconnect(ip, proxy, port, ipaddr, localip, ctimeout, mdat, logerr, can_whitelist); |
|
|
|
@ -694,12 +705,6 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna |
|
|
|
|
return 52; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(remotename) |
|
|
|
|
free(remotename); |
|
|
|
|
|
|
|
|
|
if(authorization) |
|
|
|
|
free(authorization); |
|
|
|
|
|
|
|
|
|
/* read http headers */ |
|
|
|
|
ch = buffer; |
|
|
|
|
i = 0; |
|
|
|
|