--- a/src/gaimrc.c Mon Aug 25 00:39:39 2003 +0000 +++ b/src/gaimrc.c Mon Aug 25 02:49:42 2003 +0000 @@ -1347,106 +1347,6 @@ } } -static gboolean gaimrc_parse_proxy_uri(const char *proxy) -{ - GaimProxyInfo *info; - - char *c, *d; - char buffer[2048]; - - char host[128]; - char user[128]; - char pass[128]; - int port = 0; - int len = 0; - - host[0] = '\0'; - user[0] = '\0'; - pass[0] = '\0'; - - gaim_debug(GAIM_DEBUG_MISC, "gaimrc", - "gaimrc_parse_proxy_uri(%s)\n", proxy); - - if ((c = strchr(proxy, ':')) == NULL) - { - gaim_debug(GAIM_DEBUG_ERROR, "gaimrc", - "No URI detected.\n"); - /* No URI detected. */ - return FALSE; - } - - len = c - proxy; - - if (strncmp(proxy, "http://", len + 3)) - return FALSE; - - gaim_debug(GAIM_DEBUG_MISC, "gaimrc", "Found HTTP proxy.\n"); - /* Get past "://" */ - c += 3; - - gaim_debug(GAIM_DEBUG_MISC, "gaimrc", "Looking at %s\n", c); - - for (;;) - { - *buffer = '\0'; - d = buffer; - - while (*c != '\0' && *c != '@' && *c != ':' && *c != '/') - *d++ = *c++; - - *d = '\0'; - - if (*c == ':') - { - /* - * If there is a '@' in there somewhere, we are in the auth part. - * If not, host. - */ - if (strchr(c, '@') != NULL) - strcpy(user, buffer); - else - strcpy(host, buffer); - } - else if (*c == '@') - { - if (user[0] == '\0') - strcpy(user, buffer); - else - strcpy(pass, buffer); - } - else if (*c == '/' || *c == '\0') - { - if (host[0] == '\0') - strcpy(host, buffer); - else - port = atoi(buffer); - - /* Done. */ - break; - } - - c++; - } - - /* NOTE: HTTP_PROXY takes precendence. */ - info = gaim_global_proxy_get_info(); - - if (*host) gaim_proxy_info_set_host(info, host); - if (*user) gaim_proxy_info_set_username(info, user); - if (*pass) gaim_proxy_info_set_password(info, pass); - - gaim_proxy_info_set_port(info, port); - - gaim_debug(GAIM_DEBUG_MISC, "gaimrc", - "Host: '%s', User: '%s', Password: '%s', Port: %d\n", - gaim_proxy_info_get_host(info), - gaim_proxy_info_get_username(info), - gaim_proxy_info_get_password(info), - gaim_proxy_info_get_port(info)); - - return TRUE; -} - static void gaimrc_read_proxy(FILE *f) { char buf[2048]; @@ -1482,49 +1382,6 @@ gaim_proxy_info_set_password(info, p->value[0]); } } - - if (gaim_proxy_info_get_host(info) != NULL) - gaim_global_proxy_set_from_prefs(TRUE); - else { - const char *host; - gboolean getVars = TRUE; - - if ((host = g_getenv("HTTP_PROXY")) != NULL || - (host = g_getenv("http_proxy")) != NULL || - (host = g_getenv("HTTPPROXY")) != NULL) { - - gaim_proxy_info_set_host(info, host); - } - - if (gaim_proxy_info_get_host(info) != NULL) - getVars = !gaimrc_parse_proxy_uri(gaim_proxy_info_get_host(info)); - - if (getVars) - { - const char *port_str, *user, *pass; - - if ((port_str = g_getenv("HTTP_PROXY_PORT")) != NULL || - (port_str = g_getenv("http_proxy_port")) != NULL || - (port_str = g_getenv("HTTPPROXYPORT")) != NULL) { - - gaim_proxy_info_set_port(info, atoi(port_str)); - } - - if ((user = g_getenv("HTTP_PROXY_USER")) != NULL || - (user = g_getenv("http_proxy_user")) != NULL || - (user = g_getenv("HTTPPROXYUSER")) != NULL) { - - gaim_proxy_info_set_username(info, user); - } - - if ((pass = g_getenv("HTTP_PROXY_PASS")) != NULL || - (pass = g_getenv("http_proxy_pass")) != NULL || - (pass = g_getenv("HTTPPROXYPASS")) != NULL) { - - gaim_proxy_info_set_password(info, pass); - } - } - } } static void set_defaults()