changeset 1936:f0b54f592486

[gaim-migrate @ 1946] use env vars if set committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 01 Jun 2001 18:39:51 +0000
parents 22a3b4b52971
children 6a9109c79034
files src/gaimrc.c
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gaimrc.c	Fri Jun 01 18:31:30 2001 +0000
+++ b/src/gaimrc.c	Fri Jun 01 18:39:51 2001 +0000
@@ -777,6 +777,7 @@
 	struct parse *p;
 
 	buf[0] = 0;
+	proxyhost[0] = 0;
 
 	while (buf[0] != '}') {
 		if (buf[0] == '#')
@@ -799,6 +800,30 @@
 			g_snprintf(proxypass, sizeof(proxypass), "%s", p->value[0]);
 		}
 	}
+	if (!proxyhost[0]) {
+		if (g_getenv("HTTP_PROXY"))
+			g_snprintf(proxyhost, sizeof(proxyhost), "%s", g_getenv("HTTP_PROXY"));
+		else if (g_getenv("HTTPPROXY"))
+			g_snprintf(proxyhost, sizeof(proxyhost), "%s", g_getenv("HTTPPROXY"));
+
+		if (g_getenv("HTTP_PROXY_PORT"))
+			proxyport = atoi(g_getenv("HTTP_PROXY_PORT"));
+		else if (g_getenv("HTTPPROXYPORT"))
+			proxyport = atoi(g_getenv("HTTPPROXYPORT"));
+
+		if (g_getenv("HTTP_PROXY_USER"))
+			g_snprintf(proxyuser, sizeof(proxyuser), "%s", g_getenv("HTTP_PROXY_USER"));
+		else if (g_getenv("HTTPPROXYUSER"))
+			g_snprintf(proxyuser, sizeof(proxyuser), "%s", g_getenv("HTTPPROXYUSER"));
+
+		if (g_getenv("HTTP_PROXY_PASS"))
+			g_snprintf(proxypass, sizeof(proxypass), "%s", g_getenv("HTTP_PROXY_PASS"));
+		else if (g_getenv("HTTPPROXYPASS"))
+			g_snprintf(proxypass, sizeof(proxypass), "%s", g_getenv("HTTPPROXYPASS"));
+
+		if (proxyhost[0])
+			proxytype = PROXY_HTTP;
+	}
 }
 
 static void gaimrc_write_proxy(FILE *f)