1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-21 08:42:23 +00:00
freebsd-ports/www/http_load/files/patch-aa
Pav Lucistnik 3b07b583e3 - Add a patch that fixes -proxy argument
PR:		ports/83427
Submitted by:	Antony Mawer <gnats@mawer.org>
2005-07-15 21:51:10 +00:00

62 lines
1.9 KiB
Plaintext

--- http_load.c.bak Fri Jul 15 23:49:26 2005
+++ http_load.c Fri Jul 15 23:49:33 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;
@@ -825,6 +825,7 @@
ClientData client_data;
int flags;
int sip_num;
+ int rcv_bytes, error;
/* Start filling in the connection slot. */
connections[cnum].url_num = url_num;
@@ -863,6 +864,16 @@
perror( urls[url_num].url_str );
(void) close( connections[cnum].conn_fd );
return;
+ }
+
+ /* Shrink the recieve window to better imitate a slow connection. */
+ if ( do_throttle )
+ {
+ rcv_bytes = 2048;
+ error = setsockopt(connections[cnum].conn_fd, SOL_SOCKET, SO_RCVBUF,
+ (void *)&rcv_bytes, sizeof(rcv_bytes));
+ if (error)
+ perror("Setsockopt problem:");
}
if ( num_sips > 0 )