aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2006-11-07 09:18:09 +0000
committerColin Percival <cperciva@FreeBSD.org>2006-11-07 09:18:09 +0000
commitab5b7534b608e94ff77ff332823284ec509c764e (patch)
treecccbcb45aa72cc9c05a21a4970db8c5db73d54a3 /usr.sbin
parent46ee43b2ca2910bfa692d0dcb5d692770c3354aa (diff)
downloadsrc-ab5b7534b608e94ff77ff332823284ec509c764e.tar.gz
src-ab5b7534b608e94ff77ff332823284ec509c764e.zip
Notes
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/portsnap/phttpget/phttpget.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/usr.sbin/portsnap/phttpget/phttpget.c b/usr.sbin/portsnap/phttpget/phttpget.c
index 684550539a3c..315af00574c6 100644
--- a/usr.sbin/portsnap/phttpget/phttpget.c
+++ b/usr.sbin/portsnap/phttpget/phttpget.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
static const char * env_HTTP_PROXY;
static char * env_HTTP_PROXY_AUTH;
static const char * env_HTTP_USER_AGENT;
+static char * env_HTTP_TIMEOUT;
static const char * proxyport;
static char * proxyauth;
@@ -124,6 +125,7 @@ readenv(void)
char *proxy_auth_userpass, *proxy_auth_userpass64, *p;
char *proxy_auth_user = NULL;
char *proxy_auth_pass = NULL;
+ long http_timeout;
env_HTTP_PROXY = getenv("HTTP_PROXY");
if (env_HTTP_PROXY == NULL)
@@ -180,6 +182,17 @@ readenv(void)
env_HTTP_USER_AGENT = getenv("HTTP_USER_AGENT");
if (env_HTTP_USER_AGENT == NULL)
env_HTTP_USER_AGENT = "phttpget/0.1";
+
+ env_HTTP_TIMEOUT = getenv("HTTP_TIMEOUT");
+ if (env_HTTP_TIMEOUT != NULL) {
+ http_timeout = strtol(env_HTTP_TIMEOUT, &p, 10);
+ if ((*env_HTTP_TIMEOUT == '\0') || (*p != '\0') ||
+ (http_timeout < 0))
+ warnx("HTTP_TIMEOUT (%s) is not a positive integer",
+ env_HTTP_TIMEOUT);
+ else
+ timo.tv_sec = http_timeout;
+ }
}
static int