Trying to allow CONNECT methods through an Upstream proxy.
This commit is contained in:
parent
af1246c78b
commit
7a613287ee
23
src/reqs.c
23
src/reqs.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: reqs.c,v 1.28 2001-09-16 20:10:19 rjkaes Exp $
|
/* $Id: reqs.c,v 1.29 2001-10-17 04:15:35 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* This is where all the work in tinyproxy is actually done. Incoming
|
* This is where all the work in tinyproxy is actually done. Incoming
|
||||||
* connections have a new thread created for them. The thread then
|
* connections have a new thread created for them. The thread then
|
||||||
@ -635,6 +635,7 @@ static void relay_connection(struct conn_s *connptr)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (ret < 0) {
|
} else if (ret < 0) {
|
||||||
|
log_message(LOG_ERR, "Received an error in select() [\"%s\", %d], so closing connection (client_fd:%d, server_fd:%d)", strerror(errno), errno, connptr->client_fd, connptr->server_fd);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@ -801,11 +802,12 @@ internal_proxy:
|
|||||||
goto send_error;
|
goto send_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!connptr->ssl) {
|
||||||
/*
|
/*
|
||||||
* Send a new request line, plus the Host and
|
* Send a new request line, plus the Host and
|
||||||
* Connection headers. The reason for the new request
|
* Connection headers. The reason for the new
|
||||||
* line is that we need to specify the HTTP/1.0
|
* request line is that we need to specify
|
||||||
* protocol.
|
* the HTTP/1.0 protocol.
|
||||||
*/
|
*/
|
||||||
safe_write(connptr->server_fd, request->method, strlen(request->method));
|
safe_write(connptr->server_fd, request->method, strlen(request->method));
|
||||||
safe_write(connptr->server_fd, " http://", 8);
|
safe_write(connptr->server_fd, " http://", 8);
|
||||||
@ -823,6 +825,19 @@ internal_proxy:
|
|||||||
safe_write(connptr->server_fd, "Host: ", 6);
|
safe_write(connptr->server_fd, "Host: ", 6);
|
||||||
safe_write(connptr->server_fd, request->host, strlen(request->host));
|
safe_write(connptr->server_fd, request->host, strlen(request->host));
|
||||||
safe_write(connptr->server_fd, "\r\nConnection: close\r\n", 21);
|
safe_write(connptr->server_fd, "\r\nConnection: close\r\n", 21);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* This is a CONNECT request, so send that.
|
||||||
|
*/
|
||||||
|
char port_string[16];
|
||||||
|
sprintf(port_string, ":%d", request->port);
|
||||||
|
|
||||||
|
safe_write(connptr->server_fd, request->method, strlen(request->method));
|
||||||
|
safe_write(connptr->server_fd, " ", 1);
|
||||||
|
safe_write(connptr->server_fd, request->host, strlen(request->host));
|
||||||
|
safe_write(connptr->server_fd, port_string, strlen(port_string));
|
||||||
|
safe_write(connptr->server_fd, " HTTP/1.0\r\n", 11);
|
||||||
|
}
|
||||||
|
|
||||||
free_request_struct(request);
|
free_request_struct(request);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user