# HG changeset patch # User Sulabh Mahajan # Date 1211746092 0 # Node ID 5ec08738906cdfbf002531532aa697c33d1ea119 # Parent 0f7324a8263fdba14abc6ba0982c12c737114249 Use HTTP/1.1 to get token to open inbox diff -r 0f7324a8263f -r 5ec08738906c libpurple/protocols/yahoo/yahoo.c --- a/libpurple/protocols/yahoo/yahoo.c Sun May 25 18:48:38 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Sun May 25 20:08:12 2008 +0000 @@ -3479,11 +3479,13 @@ static void yahoo_get_inbox_token_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *token, size_t len, const gchar *error_message) + const gchar *webdata, size_t len, const gchar *error_message) { PurpleConnection *gc = user_data; gboolean set_cookie = FALSE; gchar *url; + gchar *token = NULL; + int token_size; struct yahoo_data *yd = gc->proto_data; g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); @@ -3492,8 +3494,14 @@ if (error_message != NULL) purple_debug_error("yahoo", "Requesting mail login token failed: %s\n", error_message); - else if (len > 0 && token && *token) { - /* Should we not be hardcoding the rd url? */ + else if (len > 0 && webdata && *webdata) { + /*Extract token from the chunked webdata*/ + sscanf(webdata,"%x",&token_size); + token = g_malloc(token_size); + strncpy(token, strstr(webdata,"\r\n")+2, token_size); + token[token_size-1]='\0'; + + /* Should we not be hardcoding the rd url? */ url = g_strdup_printf( "http://login.yahoo.com/config/reset_cookies_token?" ".token=%s" @@ -3511,6 +3519,7 @@ purple_notify_uri(gc, url); g_free(url); + g_free(token); } @@ -3525,12 +3534,13 @@ PurpleUtilFetchUrlData *url_data; const char* base_url = "http://login.yahoo.com"; char *request = g_strdup_printf( - "POST /config/cookie_token HTTP/1.0\r\n" - "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n" + "POST /config/cookie_token HTTP/1.1\r\n" + "Cookie: Y=%s; path=/; domain=.yahoo.com; T=%s; path=/; domain=.yahoo.com;\r\n" "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" "Host: login.yahoo.com\r\n" - "Content-Length: 0\r\n\r\n", - yd->cookie_t, yd->cookie_y); + "Content-Length: 0\r\n" + "Cache-Control: no-cache\r\n\r\n", + yd->cookie_y, yd->cookie_t); gboolean use_whole_url = FALSE; /* use whole URL if using HTTP Proxy */