diff src/proxy.c @ 9227:9171e528d7e5

[gaim-migrate @ 10023] Patch by Don Seiler (aka rizzo) to add two additional parameters to gaim_url_parse(), which are used for storing the username and password from the URL, if they exist. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 07 Jun 2004 04:01:00 +0000
parents 39155e87c470
children 5332ebbf437b
line wrap: on
line diff
--- a/src/proxy.c	Sun Jun 06 20:56:54 2004 +0000
+++ b/src/proxy.c	Mon Jun 07 04:01:00 2004 +0000
@@ -1446,16 +1446,24 @@
 		if ((tmp = g_getenv("HTTP_PROXY")) != NULL ||
 			(tmp = g_getenv("http_proxy")) != NULL ||
 			(tmp= g_getenv("HTTPPROXY")) != NULL) {
-			char *proxyhost,*proxypath;
+			char *proxyhost,*proxypath,*proxyuser,*proxypasswd;
 			int proxyport;
 
 			/* http_proxy-format:
-			 * export http_proxy="http://your.proxy.server:port/"
+			 * export http_proxy="http://user:passwd@your.proxy.server:port/"
 			 */
-			if(gaim_url_parse(tmp, &proxyhost, &proxyport, &proxypath)) {
+			if(gaim_url_parse(tmp, &proxyhost, &proxyport, &proxypath, &proxyuser, &proxypasswd)) {
 				gaim_proxy_info_set_host(phb->gpi, proxyhost);
 				g_free(proxyhost);
 				g_free(proxypath);
+				if (proxyuser != NULL) {
+					gaim_proxy_info_set_username(phb->gpi, proxyuser);
+					g_free(proxyuser);
+				}
+				if (proxypasswd != NULL) {
+					gaim_proxy_info_set_password(phb->gpi, proxypasswd);
+					g_free(proxypasswd);
+				}
 
 				/* only for backward compatibility */
 				if (proxyport == 80 &&
@@ -1468,6 +1476,7 @@
 			}
 		}
 
+		/* XXX: Do we want to skip this step if user/password were part of url? */
 		if ((tmp = g_getenv("HTTP_PROXY_USER")) != NULL ||
 			(tmp = g_getenv("http_proxy_user")) != NULL ||
 			(tmp = g_getenv("HTTPPROXYUSER")) != NULL)