summaryrefslogtreecommitdiff
path: root/www/urlget
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>2000-10-03 11:19:25 +0000
committeragc <agc@pkgsrc.org>2000-10-03 11:19:25 +0000
commitce9ff95b66940dbf3cd6ed65ee0b30732bca5f01 (patch)
tree140e251bd2dc84c3ea2048b3b41e032ddfffb761 /www/urlget
parent1eb7d259ca7850cbcb1c9946a800872e536e90a6 (diff)
downloadpkgsrc-ce9ff95b66940dbf3cd6ed65ee0b30732bca5f01.tar.gz
Add code for urlget to use any http_proxy setting in the environment.
Diffstat (limited to 'www/urlget')
-rw-r--r--www/urlget/files/patch-sum3
-rw-r--r--www/urlget/patches/patch-aa65
2 files changed, 68 insertions, 0 deletions
diff --git a/www/urlget/files/patch-sum b/www/urlget/files/patch-sum
new file mode 100644
index 00000000000..75f17d82fbd
--- /dev/null
+++ b/www/urlget/files/patch-sum
@@ -0,0 +1,3 @@
+$NetBSD: patch-sum,v 1.1 2000/10/03 11:19:25 agc Exp $
+
+MD5 (patch-aa) = 1c13b41e0c08d6eb6a9902e375d2e78c
diff --git a/www/urlget/patches/patch-aa b/www/urlget/patches/patch-aa
new file mode 100644
index 00000000000..6e3c7b2604b
--- /dev/null
+++ b/www/urlget/patches/patch-aa
@@ -0,0 +1,65 @@
+$NetBSD: patch-aa,v 1.1 2000/10/03 11:19:26 agc Exp $
+
+Patches to make urlget honour http_proxy environment setting
+
+--- urlget.c 2000/09/18 13:56:27 1.1
++++ urlget.c 2000/09/18 14:23:37
+@@ -91,6 +91,7 @@
+ char **postargv = NULL;
+ int c, ret, s = 0, count, sawNL;
+ int errflg = 0, postflg = 0, hdrflg = 0, oldflg = 0, debug = 0;
++ int isproxy = 0;
+ FILE *fp;
+
+ while ((c = getopt(argc, argv, "Dhop")) != EOF) {
+@@ -131,17 +132,31 @@
+ if (strncmp(url, "http:", 5) || (url[5] != '/') || (url[6] != '/'))
+ usage(argv[0]);
+
+- if ((path = strchr(host, '/')) == NULL)
+- usage(argv[0]);
+- *path++ = '\0';
+-
+- if ((p = strchr(host, ':')) != NULL) {
+- *p++ = '\0';
+- server.sin_port = htons((u_short) atoi(p));
+- } else if ((sp = getservbyname("http", "tcp")) == NULL) {
+- server.sin_port = htons((u_short) DEF_PORT);
++ if ((p = getenv("http_proxy")) == NULL) {
++ if ((path = strchr(host, '/')) == NULL)
++ usage(argv[0]);
++ *path++ = '\0';
++ if ((p = strchr(host, ':')) != NULL) {
++ *p++ = '\0';
++ server.sin_port = htons((u_short) atoi(p));
++ } else if ((sp = getservbyname("http", "tcp")) == NULL) {
++ server.sin_port = htons((u_short) DEF_PORT);
++ } else {
++ server.sin_port = sp->s_port;
++ }
+ } else {
+- server.sin_port = sp->s_port;
++ host = &p[7];
++ if ((ep = strchr(host, ':')) == NULL) {
++ server.sin_port = htons((u_short) DEF_PORT);
++ } else {
++ *ep++ = 0;
++ server.sin_port = htons((u_short) atoi(ep));
++ }
++ if ((ep = strrchr(p, '/')) != NULL) {
++ *ep = 0;
++ }
++ path = url;
++ isproxy = 1;
+ }
+
+ if ((hp = gethostbyname(host)) == NULL) {
+@@ -171,7 +186,7 @@
+ printf("host = \"%s\", port = %d\n", host, ntohs(server.sin_port));
+ }
+
+- fprintf(fp, "%s /%s%s\r\n", cmd, path, oldflg ? "" : " HTTP/1.0");
++ fprintf(fp, "%s %s%s%s\r\n", cmd, (isproxy) ? "" : "/", path, oldflg ? "" : " HTTP/1.0");
+ if (!oldflg) {
+ fprintf(fp, "Host: %s\r\n", host);
+ }