Mercurial > pidgin
comparison src/protocols/msn/msg.c @ 19816:1aa5494587e8
[gaim-migrate @ 16973]
change the soap process to below:
Post one Soap request
After finish one soap request,close the connection,
If there are more, reconect and process it.
to avoid the below problem:
in one socket, If post soap request one by one, The second will always read 0 bytes.
comitted by Ma Yuan<mayuan2006@gmail.com>
committer: Ethan Blanton <elb@pidgin.im>
| author | Ma Yuan <mayuan2006@gmail.com> |
|---|---|
| date | Tue, 22 Aug 2006 06:10:01 +0000 |
| parents | da1075366756 |
| children | ea23c4c010cf |
comparison
equal
deleted
inserted
replaced
| 19815:bffd1b96207c | 19816:1aa5494587e8 |
|---|---|
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 void | 207 void |
| 208 msn_message_parse_payload(MsnMessage *msg, | 208 msn_message_parse_payload(MsnMessage *msg, |
| 209 const char *payload, size_t payload_len) | 209 const char *payload, size_t payload_len, |
| 210 const char *line_dem,const char *body_dem) | |
| 210 { | 211 { |
| 211 char *tmp_base, *tmp; | 212 char *tmp_base, *tmp; |
| 212 const char *content_type; | 213 const char *content_type; |
| 213 char *end; | 214 char *end; |
| 214 char **elems, **cur, **tokens; | 215 char **elems, **cur, **tokens; |
| 217 gaim_debug_info("MaYuan","payload:{%s}\n",payload); | 218 gaim_debug_info("MaYuan","payload:{%s}\n",payload); |
| 218 tmp_base = tmp = g_malloc0(payload_len + 1); | 219 tmp_base = tmp = g_malloc0(payload_len + 1); |
| 219 memcpy(tmp_base, payload, payload_len); | 220 memcpy(tmp_base, payload, payload_len); |
| 220 | 221 |
| 221 /* Parse the attributes. */ | 222 /* Parse the attributes. */ |
| 222 end = strstr(tmp, "\r\n\r\n"); | 223 end = strstr(tmp, body_dem); |
| 223 /* TODO? some clients use \r delimiters instead of \r\n, the official client | 224 /* TODO? some clients use \r delimiters instead of \r\n, the official client |
| 224 * doesn't send such messages, but does handle receiving them. We'll just | 225 * doesn't send such messages, but does handle receiving them. We'll just |
| 225 * avoid crashing for now */ | 226 * avoid crashing for now */ |
| 226 if (end == NULL) { | 227 if (end == NULL) { |
| 227 g_free(tmp_base); | 228 g_free(tmp_base); |
| 228 g_return_if_reached(); | 229 g_return_if_reached(); |
| 229 } | 230 } |
| 230 *end = '\0'; | 231 *end = '\0'; |
| 231 | 232 |
| 232 elems = g_strsplit(tmp, "\r\n", 0); | 233 elems = g_strsplit(tmp, line_dem, 0); |
| 233 | 234 |
| 234 for (cur = elems; *cur != NULL; cur++){ | 235 for (cur = elems; *cur != NULL; cur++){ |
| 235 const char *key, *value; | 236 const char *key, *value; |
| 236 | 237 |
| 237 tokens = g_strsplit(*cur, ": ", 2); | 238 tokens = g_strsplit(*cur, ": ", 2); |
| 266 } | 267 } |
| 267 | 268 |
| 268 g_strfreev(elems); | 269 g_strfreev(elems); |
| 269 | 270 |
| 270 /* Proceed to the end of the "\r\n\r\n" */ | 271 /* Proceed to the end of the "\r\n\r\n" */ |
| 271 tmp = end + 4; | 272 tmp = end + strlen(body_dem); |
| 272 | 273 |
| 273 /* Now we *should* be at the body. */ | 274 /* Now we *should* be at the body. */ |
| 274 content_type = msn_message_get_content_type(msg); | 275 content_type = msn_message_get_content_type(msg); |
| 275 | 276 |
| 276 if (content_type != NULL && | 277 if (content_type != NULL && |
