httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From willem.vanp...@philips.com
Subject Fix: Proxying https does not work under Windows NT
Date Wed, 01 Mar 2000 17:27:30 GMT
The patch below fixes the https proxying problem under Windows NT.
(for more information: bugs.apache.org, PR #2014, #4680, #5107, #5823).

I only needed to replace all read() calls with recv() calls and all
write() calls with send() calls, which is the preferred way to communicate
with sockets anyway and thus should be platform independent.

Tested on:
- Windows NT 4.0 with service pack 6a (Intel)
- Compaq Tru64 Unix 4.0f (Alpha)



Willem van Pelt

Philips Digital Networks - Digital Transmission Systems
Building OAN, room 1.22   Tel: +31-40-27 32564
PO Box 80002              Fax: +31-40-27 36661
5600 JB  Eindhoven, NL


diff -rc apache_1.3.12.org/src/modules/proxy/proxy_connect.c apache_1.3.12/src/modules/proxy/proxy_connect.c
*** apache_1.3.12.org/src/modules/proxy/proxy_connect.c	Fri Aug 27 22:21:51 1999
--- apache_1.3.12/src/modules/proxy/proxy_connect.c	Wed Mar  1 12:00:19 2000
***************
*** 226,235 ****
  	Explain0("Sending the CONNECT request to the remote proxy");
  	ap_snprintf(buffer, sizeof(buffer), "CONNECT %s HTTP/1.0" CRLF,
  		    r->uri);
! 	write(sock, buffer, strlen(buffer));
  	ap_snprintf(buffer, sizeof(buffer),
  		    "Proxy-agent: %s" CRLF CRLF, ap_get_server_version());
! 	write(sock, buffer, strlen(buffer));
      }
      else {
  	Explain0("Returning 200 OK Status");
--- 226,235 ----
  	Explain0("Sending the CONNECT request to the remote proxy");
  	ap_snprintf(buffer, sizeof(buffer), "CONNECT %s HTTP/1.0" CRLF,
  		    r->uri);
! 	send(sock, buffer, strlen(buffer),0);
  	ap_snprintf(buffer, sizeof(buffer),
  		    "Proxy-agent: %s" CRLF CRLF, ap_get_server_version());
! 	send(sock, buffer, strlen(buffer),0);
      }
      else {
  	Explain0("Returning 200 OK Status");
***************
*** 252,261 ****
  	if (i) {
  	    if (FD_ISSET(sock, &fds)) {
  		Explain0("sock was set");
! 		if ((nbytes = read(sock, buffer, HUGE_STRING_LEN)) != 0) {
  		    if (nbytes == -1)
  			break;
! 		    if (write(ap_bfileno(r->connection->client, B_WR), buffer, nbytes) == EOF)
  			break;
  		    Explain1("Wrote %d bytes to client", nbytes);
  		}
--- 252,261 ----
  	if (i) {
  	    if (FD_ISSET(sock, &fds)) {
  		Explain0("sock was set");
! 		if ((nbytes = recv(sock, buffer, HUGE_STRING_LEN,0)) != 0) {
  		    if (nbytes == -1)
  			break;
! 		    if (send(ap_bfileno(r->connection->client, B_WR), buffer, nbytes,0) == EOF)
  			break;
  		    Explain1("Wrote %d bytes to client", nbytes);
  		}
***************
*** 264,274 ****
  	    }
  	    else if (FD_ISSET(ap_bfileno(r->connection->client, B_WR), &fds)) {
  		Explain0("client->fd was set");
! 		if ((nbytes = read(ap_bfileno(r->connection->client, B_WR), buffer,
! 				   HUGE_STRING_LEN)) != 0) {
  		    if (nbytes == -1)
  			break;
! 		    if (write(sock, buffer, nbytes) == EOF)
  			break;
  		    Explain1("Wrote %d bytes to server", nbytes);
  		}
--- 264,274 ----
  	    }
  	    else if (FD_ISSET(ap_bfileno(r->connection->client, B_WR), &fds)) {
  		Explain0("client->fd was set");
! 		if ((nbytes = recv(ap_bfileno(r->connection->client, B_WR), buffer,
! 				   HUGE_STRING_LEN, 0)) != 0) {
  		    if (nbytes == -1)
  			break;
! 		    if (send(sock, buffer, nbytes, 0) == EOF)
  			break;
  		    Explain1("Wrote %d bytes to server", nbytes);
  		}


Mime
View raw message