You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by di...@apache.org on 2002/04/01 06:32:41 UTC

cvs commit: httpd-2.0/support ab.c

dirkx       02/03/31 20:32:41

  Modified:    .        CHANGES
               support  ab.c
  Log:
  Made AB's use of the Host: header rfc2616 compliant as
  reported by Taisuke Yamada <ta...@iij.ad.jp>
  
  Obtained from: Mailing list
  Submitted by: Taisuke Yamada <ta...@iij.ad.jp>
  Reviewed by: Dirk-Willem van Gulik
  
  Revision  Changes    Path
  1.675     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.674
  retrieving revision 1.675
  diff -u -r1.674 -r1.675
  --- CHANGES	1 Apr 2002 03:41:31 -0000	1.674
  +++ CHANGES	1 Apr 2002 04:32:40 -0000	1.675
  @@ -11,6 +11,9 @@
     *) Update mod_cgid to not do single-byte socket reads for CGI headers
        [Brian Pane]
   
  +  *) Made AB's use of the Host: header rfc2616 compliant
  +     by Taisuke Yamada <ta...@iij.ad.jp> [Dirk-Willem van Gulik].
  +
     *) The old, legacy (and unused) code in which the scoreboard was totally
        and completely contained in a file (SCOREBOARD_FILE) has been
        removed. This does not affect scoreboards which are *mapped* to
  
  
  
  1.93      +21 -8     httpd-2.0/support/ab.c
  
  Index: ab.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/ab.c,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- ab.c	29 Mar 2002 19:20:40 -0000	1.92
  +++ ab.c	1 Apr 2002 04:32:40 -0000	1.93
  @@ -275,7 +275,7 @@
   char *gnuplot;			/* GNUplot file */
   char *csvperc;			/* CSV Percentile file */
   char url[1024];
  -char fullurl[1024];
  +char * fullurl, * colonhost;
   int isproxy = 0;
   apr_short_interval_time_t aprtimeout = 30 * APR_USEC_PER_SEC;	/* timeout value */
    /*
  @@ -1150,20 +1150,20 @@
   	sprintf(request, "%s %s HTTP/1.0\r\n"
   		"User-Agent: ApacheBench/%s\r\n"
   		"%s" "%s" "%s"
  -		"Host: %s\r\n"
  +		"Host: %s%s\r\n"
   		"Accept: */*\r\n"
   		"%s" "\r\n",
   		(posting == 0) ? "GET" : "HEAD",
   		(isproxy) ? fullurl : path,
   		AP_SERVER_BASEREVISION,
   		keepalive ? "Connection: Keep-Alive\r\n" : "",
  -		cookie, auth, host_field, hdrs);
  +		cookie, auth, host_field, colonhost, hdrs);
       }
       else {
   	sprintf(request, "POST %s HTTP/1.0\r\n"
   		"User-Agent: ApacheBench/%s\r\n"
   		"%s" "%s" "%s"
  -		"Host: %s\r\n"
  +		"Host: %s%s\r\n"
   		"Accept: */*\r\n"
   		"Content-length: %" APR_SIZE_T_FMT "\r\n"
   		"Content-type: %s\r\n"
  @@ -1173,7 +1173,7 @@
   		AP_SERVER_BASEREVISION,
   		keepalive ? "Connection: Keep-Alive\r\n" : "",
   		cookie, auth,
  -		host_field, postlen,
  +		host_field, colonhost, postlen,
   		(content_type[0]) ? content_type : "text/plain", hdrs);
       }
   
  @@ -1302,14 +1302,14 @@
   static void copyright(void)
   {
       if (!use_html) {
  -	printf("This is ApacheBench, Version %s\n", AP_SERVER_BASEREVISION " <$Revision: 1.92 $> apache-2.0");
  +	printf("This is ApacheBench, Version %s\n", AP_SERVER_BASEREVISION " <$Revision: 1.93 $> apache-2.0");
   	printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
   	printf("Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/\n");
   	printf("\n");
       }
       else {
   	printf("<p>\n");
  -	printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AP_SERVER_BASEREVISION, "$Revision: 1.92 $");
  +	printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AP_SERVER_BASEREVISION, "$Revision: 1.93 $");
   	printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
   	printf(" Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/<br>\n");
   	printf("</p>\n<p>\n");
  @@ -1368,6 +1368,9 @@
       char *scope_id;
       apr_status_t rv;
   
  +    /* Save a copy for the proxy */
  +    fullurl = apr_pstrdup(cntxt, url);
  +
       if (strlen(url) > 7 && strncmp(url, "http://", 7) == 0)
   	url += 7;
       else
  @@ -1401,9 +1404,19 @@
       else {
   	host_field = hostname;
       }
  +
       if (port == 0) {		/* no port specified */
   	port = 80;
  -    }
  +    };
  +    if ((
  +#if USE_SSL
  +         (ssl == 1) && (port != 443)) || (( ssl == 0 ) && 
  +#endif
  +         (port != 80)))
  +    {
  +	colonhost = apr_psprintf(cntxt,":%d",port);
  +    } else
  +	colonhost = "";
       return 0;
   }