version 1.65, 2006/05/25 03:48:23 |
version 1.66, 2006/06/01 22:42:11 |
|
|
int |
int |
proxy_connect(int socket, char *host) |
proxy_connect(int socket, char *host) |
{ |
{ |
|
int l; |
char buf[1024]; |
char buf[1024]; |
char *connstr, *hosttail, *port; |
char *connstr, *hosttail, *port; |
|
|
|
|
|
|
if (debug) |
if (debug) |
printf("CONNECT %s:%s HTTP/1.1\n\n", host, port); |
printf("CONNECT %s:%s HTTP/1.1\n\n", host, port); |
asprintf(&connstr, "CONNECT %s:%s HTTP/1.1\n\n", host, port); |
l = asprintf(&connstr, "CONNECT %s:%s HTTP/1.1\n\n", host, port); |
if (!connstr) |
if (l == -1) |
errx(1, "Could not allocate memory to assemble connect string!"); |
errx(1, "Could not allocate memory to assemble connect string!"); |
if (write(socket, connstr, strlen(connstr)) != strlen(connstr)) |
if (write(socket, connstr, l) != l) |
errx(1, "Could not send connect string: %s", strerror(errno)); |
errx(1, "Could not send connect string: %s", strerror(errno)); |
read(socket, &buf, sizeof(buf)); /* only proxy header XXX: error handling? */ |
read(socket, &buf, sizeof(buf)); /* only proxy header XXX: error handling? */ |
return(200); |
return(200); |