/pidgin/main: 6c2fa6d8037d: HTTP: simplify hostname getting

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Tue Oct 23 07:16:26 EDT 2012


Changeset: 6c2fa6d8037db4ae453ca5cfca4c556da134058d
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2012-10-23 13:16 +0200
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/6c2fa6d8037d

Description:

HTTP: simplify hostname getting

diffstat:

 libpurple/http.c |  10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diffs (30 lines):

diff --git a/libpurple/http.c b/libpurple/http.c
--- a/libpurple/http.c
+++ b/libpurple/http.c
@@ -524,17 +524,9 @@ static void _purple_http_gen_headers(Pur
 
 	proxy_username = purple_proxy_info_get_username(proxy);
 	if (proxy_http && proxy_username != NULL && proxy_username[0] != '\0') {
-		char hostname[256];
 		gchar *proxy_auth, *ntlm_type1, *tmp;
 		int len;
 
-		if (gethostname(hostname, sizeof(hostname)) < 0 ||
-			hostname[0] == '\0') {
-			purple_debug_warning("http", "gethostname() failed "
-				"- is your hostname set?");
-			strcpy(hostname, "localhost");
-		}
-
 		proxy_password = purple_proxy_info_get_password(proxy);
 		if (proxy_password == NULL)
 			proxy_password = "";
@@ -545,7 +537,7 @@ static void _purple_http_gen_headers(Pur
 		memset(tmp, 0, len);
 		g_free(tmp);
 
-		ntlm_type1 = purple_ntlm_gen_type1(hostname, "");
+		ntlm_type1 = purple_ntlm_gen_type1(purple_get_host_name(), "");
 
 		g_string_append_printf(h, "Proxy-Authorization: Basic %s\r\n",
 			proxy_auth);



More information about the Commits mailing list