Thu, 07 Jan 2010 23:42:35 +0000
*** Plucked rev a4105927631316ffdb067afdc949f143c2c42e83 (f05c54b03e6bbfdbff38c01697fbd353a969e05e):
disapproval of revision '91b156de0ca0323eacfa2f7ff90987613f034372'
This change has produced regressions when using HTTP/1.0, as the proxy closes the connection, which is treated as a connection failure. Closes #10880, #10856 for examples. Refs #2910.
| libpurple/proxy.c | file | annotate | diff | comparison | revisions |
--- a/libpurple/proxy.c Thu Jan 07 23:42:06 2010 +0000 +++ b/libpurple/proxy.c Thu Jan 07 23:42:35 2010 +0000 @@ -1099,6 +1099,36 @@ connect_data->host, connect_data->port, connect_data->host, connect_data->port); + if (purple_proxy_info_get_username(connect_data->gpi) != NULL) + { + char *t1, *t2, *ntlm_type1; + char hostname[256]; + + ret = gethostname(hostname, sizeof(hostname)); + hostname[sizeof(hostname) - 1] = '\0'; + if (ret < 0 || hostname[0] == '\0') { + purple_debug_warning("proxy", "gethostname() failed -- is your hostname set?"); + strcpy(hostname, "localhost"); + } + + t1 = g_strdup_printf("%s:%s", + purple_proxy_info_get_username(connect_data->gpi), + purple_proxy_info_get_password(connect_data->gpi) ? + purple_proxy_info_get_password(connect_data->gpi) : ""); + t2 = purple_base64_encode((const guchar *)t1, strlen(t1)); + g_free(t1); + + ntlm_type1 = purple_ntlm_gen_type1(hostname, ""); + + g_string_append_printf(request, + "Proxy-Authorization: Basic %s\r\n" + "Proxy-Authorization: NTLM %s\r\n" + "Proxy-Connection: Keep-Alive\r\n", + t2, ntlm_type1); + g_free(ntlm_type1); + g_free(t2); + } + g_string_append(request, "\r\n"); connect_data->write_buf_len = request->len;