comparison src/protocols/msn/httpmethod.c @ 8299:7402101c0319

[gaim-migrate @ 9023] Ladies and gentlemen, MSN port 80 connect method. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 20 Feb 2004 22:11:56 +0000
parents c719f9a181d4
children 06f57183e29f
comparison
equal deleted inserted replaced
8298:c719f9a181d4 8299:7402101c0319
56 { 56 {
57 servconn = (MsnServConn *)l->data; 57 servconn = (MsnServConn *)l->data;
58 58
59 if (servconn->http_data->dirty) 59 if (servconn->http_data->dirty)
60 { 60 {
61 #if 0
61 gaim_debug_info("msn", "Polling server %s.\n", 62 gaim_debug_info("msn", "Polling server %s.\n",
62 servconn->http_data->gateway_ip); 63 servconn->http_data->gateway_ip);
64 #endif
63 msn_http_servconn_poll(servconn); 65 msn_http_servconn_poll(servconn);
64 } 66 }
65 } 67 }
66 68
67 return TRUE; 69 return TRUE;
70 static void 72 static void
71 stop_timer(MsnSession *session) 73 stop_timer(MsnSession *session)
72 { 74 {
73 if (session->http_poll_timer) 75 if (session->http_poll_timer)
74 { 76 {
75 gaim_debug(GAIM_DEBUG_INFO, "msn", "Stopping timer\n");
76 gaim_timeout_remove(session->http_poll_timer); 77 gaim_timeout_remove(session->http_poll_timer);
77 session->http_poll_timer = 0; 78 session->http_poll_timer = 0;
78 } 79 }
79 } 80 }
80 81
81 static void 82 static void
82 start_timer(MsnSession *session) 83 start_timer(MsnSession *session)
83 { 84 {
84 stop_timer(session); 85 stop_timer(session);
85 86
86 gaim_debug(GAIM_DEBUG_INFO, "msn", "Starting timer\n"); 87 session->http_poll_timer = gaim_timeout_add(2000, http_poll, session);
87 session->http_poll_timer = gaim_timeout_add(5000, http_poll, session);
88 } 88 }
89 89
90 void 90 void
91 msn_http_session_init(MsnSession *session) 91 msn_http_session_init(MsnSession *session)
92 { 92 {
177 (int)size, 177 (int)size,
178 buf); 178 buf);
179 179
180 g_free(params); 180 g_free(params);
181 181
182 #if 1 182 #if 0
183 gaim_debug_misc("msn", "Writing HTTP to fd %d: {%s}\n", 183 gaim_debug_misc("msn", "Writing HTTP to fd %d: {%s}\n",
184 servconn->fd, temp); 184 servconn->fd, temp);
185 #endif 185 #endif
186 186
187 s = 0; 187 s = 0;
237 "\r\n", 237 "\r\n",
238 servconn->http_data->gateway_ip, 238 servconn->http_data->gateway_ip,
239 servconn->http_data->session_id, 239 servconn->http_data->session_id,
240 servconn->http_data->gateway_ip); 240 servconn->http_data->gateway_ip);
241 241
242 #if 0
242 gaim_debug_misc("msn", "Writing to HTTP: {%s}\n", temp); 243 gaim_debug_misc("msn", "Writing to HTTP: {%s}\n", temp);
244 #endif
243 245
244 s = write(servconn->fd, temp, strlen(temp)); 246 s = write(servconn->fd, temp, strlen(temp));
245 247
246 g_free(temp); 248 g_free(temp);
247 249
269 g_return_val_if_fail(size > 0, FALSE); 271 g_return_val_if_fail(size > 0, FALSE);
270 g_return_val_if_fail(ret_buf != NULL, FALSE); 272 g_return_val_if_fail(ret_buf != NULL, FALSE);
271 g_return_val_if_fail(ret_size != NULL, FALSE); 273 g_return_val_if_fail(ret_size != NULL, FALSE);
272 g_return_val_if_fail(error != NULL, FALSE); 274 g_return_val_if_fail(error != NULL, FALSE);
273 275
276 #if 0
274 gaim_debug_info("msn", "parsing data {%s} from fd %d\n", buf, servconn->fd); 277 gaim_debug_info("msn", "parsing data {%s} from fd %d\n", buf, servconn->fd);
278 #endif
275 servconn->http_data->waiting_response = FALSE; 279 servconn->http_data->waiting_response = FALSE;
276 280
277 gc = gaim_account_get_connection(servconn->session->account); 281 gc = gaim_account_get_connection(servconn->session->account);
278 282
279 /* Healthy defaults. */ 283 /* Healthy defaults. */
315 319
316 headers = g_strndup(buf, s - buf); 320 headers = g_strndup(buf, s - buf);
317 s += 4; /* Skip \r\n */ 321 s += 4; /* Skip \r\n */
318 body = g_strndup(s, size - (s - buf)); 322 body = g_strndup(s, size - (s - buf));
319 323
324 #if 0
320 gaim_debug_misc("msn", "Incoming HTTP buffer: {%s\r\n%s}", headers, body); 325 gaim_debug_misc("msn", "Incoming HTTP buffer: {%s\r\n%s}", headers, body);
326 #endif
321 327
322 if ((s = strstr(headers, "Content-Length: ")) != NULL) 328 if ((s = strstr(headers, "Content-Length: ")) != NULL)
323 { 329 {
324 s += strlen("Content-Length: "); 330 s += strlen("Content-Length: ");
325 331