Mercurial > pidgin
comparison src/util.c @ 9341:cf5b5b63228d
[gaim-migrate @ 10149]
rizzo, with i think some help from wing, who approves this patch, fixed
an issue with his previous patch, where basicly gaim_url_fetch would fail
on a link like http://foo.bar/blah@blah because it mistook the
foo.bar/blah@ part for a user name.
The most notable thing this fixes is Get Info on MSN people, which wing's
earlier patch made pretty cool, except for the not working part due to
rizzo's earlier patch. So everyone Get Info on their msn buddies and
oooh and aaah at the pictures and stuff.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Tue, 22 Jun 2004 04:07:49 +0000 |
parents | c5fdff22b252 |
children | 79c4acbac4cd |
comparison
equal
deleted
inserted
replaced
9340:7fa8eff579b5 | 9341:cf5b5b63228d |
---|---|
2441 } | 2441 } |
2442 | 2442 |
2443 /************************************************************************** | 2443 /************************************************************************** |
2444 * URI/URL Functions | 2444 * URI/URL Functions |
2445 **************************************************************************/ | 2445 **************************************************************************/ |
2446 /* | |
2447 * Would be nice when dissecting an environmental variable | |
2448 * that specifies proxy information. | |
2449 */ | |
2450 gboolean | 2446 gboolean |
2451 gaim_url_parse(const char *url, char **ret_host, int *ret_port, | 2447 gaim_url_parse(const char *url, char **ret_host, int *ret_port, |
2452 char **ret_path, char **ret_user, char **ret_passwd) | 2448 char **ret_path, char **ret_user, char **ret_passwd) |
2453 { | 2449 { |
2454 char scan_info[255]; | 2450 char scan_info[255]; |
2455 char port_str[6]; | 2451 char port_str[6]; |
2456 int f; | 2452 int f; |
2457 const char *at; | 2453 const char *at, *slash; |
2458 const char *turl; | 2454 const char *turl; |
2459 char host[256], path[256], user[256], passwd[256]; | 2455 char host[256], path[256], user[256], passwd[256]; |
2460 int port = 0; | 2456 int port = 0; |
2461 /* hyphen at end includes it in control set */ | 2457 /* hyphen at end includes it in control set */ |
2462 static char addr_ctrl[] = "A-Za-z0-9.-"; | 2458 static char addr_ctrl[] = "A-Za-z0-9.-"; |
2473 turl += 7; | 2469 turl += 7; |
2474 url = turl; | 2470 url = turl; |
2475 } | 2471 } |
2476 | 2472 |
2477 /* parse out authentication information if supplied */ | 2473 /* parse out authentication information if supplied */ |
2478 if ((at = strchr(url, '@')) != NULL) { | 2474 /* Only care about @ char BEFORE the first / */ |
2475 at = strchr(url, '@'); | |
2476 slash = strchr(url, '/'); | |
2477 if ((at != NULL) && | |
2478 (((slash != NULL) && (strlen(at) > strlen(slash))) || | |
2479 (slash == NULL))) { | |
2479 g_snprintf(scan_info, sizeof(scan_info), | 2480 g_snprintf(scan_info, sizeof(scan_info), |
2480 "%%255[%s]:%%255[%s]^@", user_ctrl, passwd_ctrl); | 2481 "%%255[%s]:%%255[%s]^@", user_ctrl, passwd_ctrl); |
2481 f = sscanf(url, scan_info, user, passwd); | 2482 f = sscanf(url, scan_info, user, passwd); |
2482 | 2483 |
2483 if (f ==1 ) { | 2484 if (f ==1 ) { |