Skip site navigation (1)Skip section navigation (2)
Date:      14 Jul 2005 01:20:20 -0000
From:      Antony Mawer <gnats@mawer.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/83427: [patch] www/http_load proxy support does not work
Message-ID:  <20050714012020.55550.qmail@c211-30-90-140.belrs3.nsw.optusnet.com.au>
Resent-Message-ID: <200507140130.j6E1UJab052564@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         83427
>Category:       ports
>Synopsis:       [patch] www/http_load proxy support does not work
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 14 01:30:18 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Antony Mawer <gnats@mawer.org>
>Release:        FreeBSD 4.11-RELEASE-p3 i386
>Organization:
GP Technology Solutions
>Environment:
System: FreeBSD gwsquish.enchanted.net 4.11-RELEASE-p3 FreeBSD 4.11-RELEASE-p3 #4: Mon Apr 18 21:09:02 EST 2005 root@gwsquish.enchanted.net:/usr/obj/usr/src/sys/FREEANT i386

>Description:
	The -proxy argument to the http_load port does not have any effect.
	HTTP requests are always made direct to the remote server instead
	of going via the specified proxy server.

	The same issue can be found in the NetBSD PR database located here:
	http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=26541
>How-To-Repeat:
	Run the http_load command with a proxy:

	http_load -proxy <proxyhost>:<port> -rate 5 -seconds 10 urls.txt

	Observe that no traffic goes via the proxy server, and instead all
	requests are made direct to the remote web servers specified in urls.txt
>Fix:
	This patch is essentially identical to the one from NetBSD PR 26541,
	with a further change that appears to have been missed in that PR. The
	attached patch fixes the issue and has been tested successfully. After
	rebuilding with the attached patch, http_load correctly sends traffic
	via the specified proxy server.

--- patch-ab begins here ---
--- http_load.c.old	Thu Jul 14 11:05:48 2005
+++ http_load.c	Thu Jul 14 11:06:41 2005
@@ -655,11 +655,11 @@
     (void) memset( &hints, 0, sizeof(hints) );
     hints.ai_family = PF_UNSPEC;
     hints.ai_socktype = SOCK_STREAM;
-    (void) snprintf( portstr, sizeof(portstr), "%d", (int) urls[url_num].port );
-    if ( (gaierr = getaddrinfo( urls[url_num].hostname, portstr, &hints, &ai )) != 0 )
+    (void) snprintf( portstr, sizeof(portstr), "%d", (int) port );
+    if ( (gaierr = getaddrinfo( hostname, portstr, &hints, &ai )) != 0 )
 	{
 	(void) fprintf(
-	    stderr, "%s: getaddrinfo %s - %s\n", argv0, urls[url_num].hostname,
+	    stderr, "%s: getaddrinfo %s - %s\n", argv0, hostname,
 	    gai_strerror( gaierr ) );
 	exit( 1 );
 	}
@@ -724,15 +724,15 @@
 
     (void) fprintf(
 	stderr, "%s: no valid address found for host %s\n", argv0,
-	urls[url_num].hostname );
+	hostname );
     exit( 1 );
 
 #else /* USE_IPV6 */
 
-    he = gethostbyname( urls[url_num].hostname );
+    he = gethostbyname( hostname );
     if ( he == (struct hostent*) 0 )
 	{
-	(void) fprintf( stderr, "%s: unknown host - %s\n", argv0, urls[url_num].hostname );
+	(void) fprintf( stderr, "%s: unknown host - %s\n", argv0, hostname );
 	exit( 1 );
 	}
     urls[url_num].sock_family = urls[url_num].sa.sin_family = he->h_addrtype;
--- patch-ab ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050714012020.55550.qmail>