changeset 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 7fa8eff579b5
children 33693eea90d7
files src/util.c
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/util.c	Tue Jun 22 01:05:42 2004 +0000
+++ b/src/util.c	Tue Jun 22 04:07:49 2004 +0000
@@ -2443,10 +2443,6 @@
 /**************************************************************************
  * URI/URL Functions
  **************************************************************************/
-/*
- * Would be nice when dissecting an environmental variable
- * that specifies proxy information.
- */
 gboolean
 gaim_url_parse(const char *url, char **ret_host, int *ret_port,
 			   char **ret_path, char **ret_user, char **ret_passwd)
@@ -2454,7 +2450,7 @@
 	char scan_info[255];
 	char port_str[6];
 	int f;
-	const char *at;
+	const char *at, *slash;
 	const char *turl;
 	char host[256], path[256], user[256], passwd[256];
 	int port = 0;
@@ -2475,7 +2471,12 @@
 	}
 
 	/* parse out authentication information if supplied */
-	if ((at = strchr(url, '@')) != NULL) {
+	/* Only care about @ char BEFORE the first / */
+	at = strchr(url, '@');
+	slash = strchr(url, '/');
+	if ((at != NULL) &&
+			(((slash != NULL) && (strlen(at) > strlen(slash))) ||
+			(slash == NULL))) {
 		g_snprintf(scan_info, sizeof(scan_info),
 					"%%255[%s]:%%255[%s]^@", user_ctrl, passwd_ctrl);
 		f = sscanf(url, scan_info, user, passwd);