Mercurial > pidgin.yaz
comparison libpurple/proxy.c @ 29127:c01d4a1c7ee5
disapproval of revision '32e63a51dbb65b8b63d134bde098d40167574148'
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.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 03 Dec 2009 05:45:30 +0000 |
parents | f2a69bee9ef6 |
children | 6846e88e76e3 |
comparison
equal
deleted
inserted
replaced
29052:f2a69bee9ef6 | 29127:c01d4a1c7ee5 |
---|---|
1096 request = g_string_sized_new(4096); | 1096 request = g_string_sized_new(4096); |
1097 g_string_append_printf(request, | 1097 g_string_append_printf(request, |
1098 "CONNECT %s:%d HTTP/1.1\r\nHost: %s:%d\r\n", | 1098 "CONNECT %s:%d HTTP/1.1\r\nHost: %s:%d\r\n", |
1099 connect_data->host, connect_data->port, | 1099 connect_data->host, connect_data->port, |
1100 connect_data->host, connect_data->port); | 1100 connect_data->host, connect_data->port); |
1101 | |
1102 if (purple_proxy_info_get_username(connect_data->gpi) != NULL) | |
1103 { | |
1104 char *t1, *t2, *ntlm_type1; | |
1105 char hostname[256]; | |
1106 | |
1107 ret = gethostname(hostname, sizeof(hostname)); | |
1108 hostname[sizeof(hostname) - 1] = '\0'; | |
1109 if (ret < 0 || hostname[0] == '\0') { | |
1110 purple_debug_warning("proxy", "gethostname() failed -- is your hostname set?"); | |
1111 strcpy(hostname, "localhost"); | |
1112 } | |
1113 | |
1114 t1 = g_strdup_printf("%s:%s", | |
1115 purple_proxy_info_get_username(connect_data->gpi), | |
1116 purple_proxy_info_get_password(connect_data->gpi) ? | |
1117 purple_proxy_info_get_password(connect_data->gpi) : ""); | |
1118 t2 = purple_base64_encode((const guchar *)t1, strlen(t1)); | |
1119 g_free(t1); | |
1120 | |
1121 ntlm_type1 = purple_ntlm_gen_type1(hostname, ""); | |
1122 | |
1123 g_string_append_printf(request, | |
1124 "Proxy-Authorization: Basic %s\r\n" | |
1125 "Proxy-Authorization: NTLM %s\r\n" | |
1126 "Proxy-Connection: Keep-Alive\r\n", | |
1127 t2, ntlm_type1); | |
1128 g_free(ntlm_type1); | |
1129 g_free(t2); | |
1130 } | |
1101 | 1131 |
1102 g_string_append(request, "\r\n"); | 1132 g_string_append(request, "\r\n"); |
1103 | 1133 |
1104 connect_data->write_buf_len = request->len; | 1134 connect_data->write_buf_len = request->len; |
1105 connect_data->write_buffer = (guchar *)g_string_free(request, FALSE); | 1135 connect_data->write_buffer = (guchar *)g_string_free(request, FALSE); |