diff options
author | arved <arved@FreeBSD.org> | 2004-12-15 18:17:20 +0000 |
---|---|---|
committer | arved <arved@FreeBSD.org> | 2004-12-15 18:17:20 +0000 |
commit | 65bd3de823f595e5590889d2652b8c3ceb083451 (patch) | |
tree | b2fdc998e6e67f265b64dbd2d59497c0f709df89 /www/http_get | |
parent | 65e38991984f9b79ae5631a67966e12249082bee (diff) | |
download | FreeBSD-ports-65bd3de823f595e5590889d2652b8c3ceb083451.zip FreeBSD-ports-65bd3de823f595e5590889d2652b8c3ceb083451.tar.gz |
Add an -h option, argument for debugging multihomed URLs
PR: 72144
Submitted by: Jim Salter <send-pr@jrssystems.net>
Approved by: maintainer
Diffstat (limited to 'www/http_get')
-rw-r--r-- | www/http_get/Makefile | 1 | ||||
-rw-r--r-- | www/http_get/files/patch-http_get.c | 69 |
2 files changed, 70 insertions, 0 deletions
diff --git a/www/http_get/Makefile b/www/http_get/Makefile index 650686b..c609962 100644 --- a/www/http_get/Makefile +++ b/www/http_get/Makefile @@ -7,6 +7,7 @@ PORTNAME= http_get PORTVERSION= 1.0 +PORTREVISION= 1 CATEGORIES= www MASTER_SITES= http://www.acme.com/software/http_get/ DISTNAME= ${PORTNAME}_18mar2002 diff --git a/www/http_get/files/patch-http_get.c b/www/http_get/files/patch-http_get.c new file mode 100644 index 0000000..219b087 --- /dev/null +++ b/www/http_get/files/patch-http_get.c @@ -0,0 +1,69 @@ +--- http_get.c.orig Wed Dec 15 19:10:11 2004 ++++ http_get.c Wed Dec 15 19:10:30 2004 +@@ -2,7 +2,9 @@ + ** + ** Originally based on a simple version by Al Globus <globus@nas.nasa.gov>. + ** Debugged and prettified by Jef Poskanzer <jef@acme.com>. Also includes +-** ifdefs to handle https via OpenSSL. ++** ifdefs to handle https via OpenSSL. -h argument for debugging multihomed ++** URLs added by Jim Salter. ++** + */ + + #include <unistd.h> +@@ -35,6 +37,7 @@ + static int verbose; + static int timeout; + static char* url; ++static char* force_host; + + /* Protocol symbols. */ + #define PROTO_HTTP 0 +@@ -72,6 +75,8 @@ + user_agent = "http_get"; + auth_token = (char*) 0; + cookie = (char*) 0; ++ force_host = (char*) "[NONE]"; ++ + while ( argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0' ) + { + if ( strcmp( argv[argn], "-v" ) == 0 ) +@@ -81,6 +86,11 @@ + ++argn; + timeout = atoi( argv[argn] ); + } ++ else if ( strcmp( argv[argn], "-h" ) == 0 && argn + 1 < argc ) ++ { ++ ++argn; ++ force_host = argv[argn]; ++ } + else if ( strcmp( argv[argn], "-r" ) == 0 && argn + 1 < argc ) + { + ++argn; +@@ -127,7 +137,7 @@ + static void + usage() + { +- (void) fprintf( stderr, "usage: %s [-t timeout] [-r referer] [-u user-agent] [-a username:password] url\n", argv0 ); ++ (void) fprintf( stderr, "usage: %s [-t timeout] [-h force host address] [-r referer] [-u user-agent] [-a username:password] url\n", argv0 ); + exit( 1 ); + } + +@@ -218,7 +228,16 @@ + int bytes, b, header_state, status; + + (void) alarm( timeout ); +- sockfd = open_client_socket( host, port ); ++ ++if ( force_host == "[NONE]" ) ++ { ++ sockfd = open_client_socket( host, port ); ++ } ++else ++ { ++ sockfd = open_client_socket( force_host, port ); ++ } ++ + + #ifdef USE_SSL + if ( protocol == PROTO_HTTPS ) |