httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: apache-1.3/src/support ab.c
Date Fri, 25 May 2001 08:09:49 GMT
dirkx       01/05/25 01:09:48

  Modified:    src/support ab.c
  Log:
  Cleaning up/fix proxy/Host: header logic. Working to do the same
  for apache-2.0 where we also have an ascii [num] representation of
  IPv6's to take into account which currently only takes the non
  proxy situation into account.
  
  Revision  Changes    Path
  1.54      +30 -12    apache-1.3/src/support/ab.c
  
  Index: ab.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/support/ab.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -u -r1.53 -r1.54
  --- ab.c	2001/05/22 22:52:18	1.53
  +++ ab.c	2001/05/25 08:09:47	1.54
  @@ -1195,16 +1195,35 @@
       struct timeval timeout, now;
       fd_set sel_read, sel_except, sel_write;
       long i;
  -    char connecthost[1024];
       int connectport;
  +    char * url_on_request, * host;
   
  +    /* There are four hostname's involved:
  +     * The 'hostname' from the URL, the
  +     * hostname of the proxy, the value which
  +     * is to go into the Host: header and
  +     * the hostname we connect to over TCP.
  +     */
       if (isproxy) {
  -	strcpy(connecthost, proxyhost);
  +	/* Connect to proxyhost:proxyport
  +         * And set Host: to the hostname of
  +         * the proxy - whistl quoting the
  +	 * full URL in the GET/POST line.
  +	 */
  +	host  = proxyhost;
   	connectport = proxyport;
  +    	url_on_request = fullurl;
       }
       else {
  -	strcpy(connecthost, hostname);
  +	/* When there is no proxy: 
  +	 * use the hostname to connect to,
  +	 * use the hostname in the Host:
  +	 * header; and do not quote a full
  +	 * URL in the GET/POST line.
  +	 */
  +	host  = hostname;
   	connectport = port;
  +    	url_on_request = path;
       }
   
       if (!use_html) {
  @@ -1215,10 +1234,10 @@
       {
   	/* get server information */
   	struct hostent *he;
  -	he = gethostbyname(connecthost);
  +	he = gethostbyname(host);
   	if (!he) {
   	    char theerror[1024];
  -	    sprintf(theerror, "Bad hostname: %s\n", connecthost);
  +	    sprintf(theerror, "Bad hostname: %s\n", host);
   	    err(theerror);
   	}
   	server.sin_family = he->h_addrtype;
  @@ -1243,12 +1262,11 @@
   		"Accept: */*\r\n"
   		"%s" "\r\n",
   		(posting == 0) ? "GET" : "HEAD",
  -		(isproxy) ? fullurl : path,
  +		url_on_request,
   		VERSION,
   		keepalive ? "Connection: Keep-Alive\r\n" : "",
   		cookie, auth, 
  -		proxyhost, 
  -		hdrs);
  +		host, hdrs);
       }
       else {
   	sprintf(request, "POST %s HTTP/1.0\r\n"
  @@ -1260,11 +1278,11 @@
   		"Content-type: %s\r\n"
   		"%s"
   		"\r\n",
  -		(isproxy) ? fullurl : path, 
  +		url_on_request,
   		VERSION,
   		keepalive ? "Connection: Keep-Alive\r\n" : "",
   		cookie, auth,
  -		proxyhost, postlen,
  +		host, postlen,
   		(content_type[0]) ? content_type : "text/plain", hdrs);
       }
   
  @@ -1338,14 +1356,14 @@
   static void copyright(void)
   {
       if (!use_html) {
  -	printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.53 $> apache-1.3");
  +	printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.54 $> apache-1.3");
   	printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
   	printf("Copyright (c) 1998-1999 The Apache Group, http://www.apache.org/\n");
   	printf("\n");
       }
       else {
   	printf("<p>\n");
  -	printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-1.3<br>\n",
VERSION, "$Revision: 1.53 $");
  +	printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-1.3<br>\n",
VERSION, "$Revision: 1.54 $");
   	printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
   	printf(" Copyright (c) 1998-1999 The Apache Group, http://www.apache.org/<br>\n");
   	printf("</p>\n<p>\n");
  
  
  

Mime
View raw message