Mercurial > pidgin
comparison 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 |
comparison
equal
deleted
inserted
replaced
9226:7a00289f2ef1 | 9227:9171e528d7e5 |
---|---|
1444 | 1444 |
1445 if (gaim_proxy_info_get_type(phb->gpi) == GAIM_PROXY_USE_ENVVAR) { | 1445 if (gaim_proxy_info_get_type(phb->gpi) == GAIM_PROXY_USE_ENVVAR) { |
1446 if ((tmp = g_getenv("HTTP_PROXY")) != NULL || | 1446 if ((tmp = g_getenv("HTTP_PROXY")) != NULL || |
1447 (tmp = g_getenv("http_proxy")) != NULL || | 1447 (tmp = g_getenv("http_proxy")) != NULL || |
1448 (tmp= g_getenv("HTTPPROXY")) != NULL) { | 1448 (tmp= g_getenv("HTTPPROXY")) != NULL) { |
1449 char *proxyhost,*proxypath; | 1449 char *proxyhost,*proxypath,*proxyuser,*proxypasswd; |
1450 int proxyport; | 1450 int proxyport; |
1451 | 1451 |
1452 /* http_proxy-format: | 1452 /* http_proxy-format: |
1453 * export http_proxy="http://your.proxy.server:port/" | 1453 * export http_proxy="http://user:passwd@your.proxy.server:port/" |
1454 */ | 1454 */ |
1455 if(gaim_url_parse(tmp, &proxyhost, &proxyport, &proxypath)) { | 1455 if(gaim_url_parse(tmp, &proxyhost, &proxyport, &proxypath, &proxyuser, &proxypasswd)) { |
1456 gaim_proxy_info_set_host(phb->gpi, proxyhost); | 1456 gaim_proxy_info_set_host(phb->gpi, proxyhost); |
1457 g_free(proxyhost); | 1457 g_free(proxyhost); |
1458 g_free(proxypath); | 1458 g_free(proxypath); |
1459 if (proxyuser != NULL) { | |
1460 gaim_proxy_info_set_username(phb->gpi, proxyuser); | |
1461 g_free(proxyuser); | |
1462 } | |
1463 if (proxypasswd != NULL) { | |
1464 gaim_proxy_info_set_password(phb->gpi, proxypasswd); | |
1465 g_free(proxypasswd); | |
1466 } | |
1459 | 1467 |
1460 /* only for backward compatibility */ | 1468 /* only for backward compatibility */ |
1461 if (proxyport == 80 && | 1469 if (proxyport == 80 && |
1462 ((tmp = g_getenv("HTTP_PROXY_PORT")) != NULL || | 1470 ((tmp = g_getenv("HTTP_PROXY_PORT")) != NULL || |
1463 (tmp = g_getenv("http_proxy_port")) != NULL || | 1471 (tmp = g_getenv("http_proxy_port")) != NULL || |
1466 | 1474 |
1467 gaim_proxy_info_set_port(phb->gpi, proxyport); | 1475 gaim_proxy_info_set_port(phb->gpi, proxyport); |
1468 } | 1476 } |
1469 } | 1477 } |
1470 | 1478 |
1479 /* XXX: Do we want to skip this step if user/password were part of url? */ | |
1471 if ((tmp = g_getenv("HTTP_PROXY_USER")) != NULL || | 1480 if ((tmp = g_getenv("HTTP_PROXY_USER")) != NULL || |
1472 (tmp = g_getenv("http_proxy_user")) != NULL || | 1481 (tmp = g_getenv("http_proxy_user")) != NULL || |
1473 (tmp = g_getenv("HTTPPROXYUSER")) != NULL) | 1482 (tmp = g_getenv("HTTPPROXYUSER")) != NULL) |
1474 gaim_proxy_info_set_username(phb->gpi, tmp); | 1483 gaim_proxy_info_set_username(phb->gpi, tmp); |
1475 | 1484 |