Trying to allow CONNECT methods through an Upstream proxy.
This commit is contained in:
		
							parent
							
								
									af1246c78b
								
							
						
					
					
						commit
						7a613287ee
					
				
							
								
								
									
										51
									
								
								src/reqs.c
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								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,29 +802,43 @@ internal_proxy:
 | 
				
			|||||||
				goto send_error;
 | 
									goto send_error;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/*
 | 
								if (!connptr->ssl) {
 | 
				
			||||||
			 * Send a new request line, plus the Host and
 | 
									/*
 | 
				
			||||||
			 * Connection headers. The reason for the new request
 | 
									 * Send a new request line, plus the Host and
 | 
				
			||||||
			 * line is that we need to specify the HTTP/1.0
 | 
									 * Connection headers. The reason for the new
 | 
				
			||||||
			 * protocol.
 | 
									 * request line is that we need to specify
 | 
				
			||||||
			 */
 | 
									 * the HTTP/1.0 protocol.
 | 
				
			||||||
			safe_write(connptr->server_fd, request->method, strlen(request->method));
 | 
									 */
 | 
				
			||||||
			safe_write(connptr->server_fd, " http://", 8);
 | 
									safe_write(connptr->server_fd, request->method, strlen(request->method));
 | 
				
			||||||
			safe_write(connptr->server_fd, request->host, strlen(request->host));
 | 
									safe_write(connptr->server_fd, " http://", 8);
 | 
				
			||||||
			if (request->port != 80) {
 | 
									safe_write(connptr->server_fd, request->host, strlen(request->host));
 | 
				
			||||||
 | 
									if (request->port != 80) {
 | 
				
			||||||
 | 
										char port_string[16];
 | 
				
			||||||
 | 
										sprintf(port_string, ":%d", request->port);
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
										safe_write(connptr->server_fd, port_string, strlen(port_string));
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									safe_write(connptr->server_fd, request->path, strlen(request->path));
 | 
				
			||||||
 | 
									safe_write(connptr->server_fd, " HTTP/1.0\r\n", 11);
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
									safe_write(connptr->server_fd, "Host: ", 6);
 | 
				
			||||||
 | 
									safe_write(connptr->server_fd, request->host, strlen(request->host));
 | 
				
			||||||
 | 
									safe_write(connptr->server_fd, "\r\nConnection: close\r\n", 21);
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									/*
 | 
				
			||||||
 | 
									 * This is a CONNECT request, so send that.
 | 
				
			||||||
 | 
									 */
 | 
				
			||||||
				char port_string[16];
 | 
									char port_string[16];
 | 
				
			||||||
				sprintf(port_string, ":%d", request->port);
 | 
									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, port_string, strlen(port_string));
 | 
				
			||||||
 | 
									safe_write(connptr->server_fd, " HTTP/1.0\r\n", 11);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			safe_write(connptr->server_fd, request->path, strlen(request->path));
 | 
					 | 
				
			||||||
			safe_write(connptr->server_fd, " HTTP/1.0\r\n", 11);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			safe_write(connptr->server_fd, "Host: ", 6);
 | 
					 | 
				
			||||||
			safe_write(connptr->server_fd, request->host, strlen(request->host));
 | 
					 | 
				
			||||||
			safe_write(connptr->server_fd, "\r\nConnection: close\r\n", 21);
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
			free_request_struct(request);
 | 
								free_request_struct(request);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user