soc.2008.yahoo: d4ff6a5a: Use HTTP/1.1 to get token to open inbox
sulabh at soc.pidgin.im
sulabh at soc.pidgin.im
Sun May 25 17:48:38 EDT 2008
-----------------------------------------------------------------
Revision: d4ff6a5af0edbbc1fa946887957e0332c5bacd00
Ancestor: 86ddac2046b8d0700a7a4a527bab044522bdfb07
Author: sulabh at soc.pidgin.im
Date: 2008-05-25T20:08:12
Branch: im.pidgin.soc.2008.yahoo
URL: http://d.pidgin.im/viewmtn/revision/info/d4ff6a5af0edbbc1fa946887957e0332c5bacd00
Modified files:
libpurple/protocols/yahoo/yahoo.c
ChangeLog:
Use HTTP/1.1 to get token to open inbox
-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c 5b5b0654092c946b0f7a2095d9f337ded071afc3
+++ libpurple/protocols/yahoo/yahoo.c 5e4f8f5279dab294ddc4b9fe6cf91c4421740ab0
@@ -3479,11 +3479,13 @@ yahoo_get_inbox_token_cb(PurpleUtilFetch
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 @@ yahoo_get_inbox_token_cb(PurpleUtilFetch
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 @@ yahoo_get_inbox_token_cb(PurpleUtilFetch
purple_notify_uri(gc, url);
g_free(url);
+ g_free(token);
}
@@ -3525,12 +3534,13 @@ static void yahoo_show_inbox(PurplePlugi
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 */
More information about the Commits
mailing list