--- gaim-0.59.9/src/html.c.buffer3	Thu Feb 12 11:59:44 2004
+++ gaim-0.59.9/src/html.c	Thu Feb 12 11:59:48 2004
@@ -78,35 +78,51 @@
 {
 	struct g_url *test = g_new0(struct g_url, 1);
 	char scan_info[255];
-	char port[5];
+	char port[6];
+        /* hyphen at end includes it in control set */
+	static char addr_ctrl[] = "A-Za-z0-9.-";
+	static char port_ctrl[] = "0-9";
+	static char page_ctrl[] = "A-Za-z0-9.~_/:*!@&%%?=+^-";
+
 	int f;
 
 	if (strstr(url, "http://"))
 		g_snprintf(scan_info, sizeof(scan_info),
-			   "http://%%[A-Za-z0-9.]:%%[0-9]/%%[A-Za-z0-9.~_-/&%%?=+]");
+			   "http://%%255[%s]:%%5[%s]/%%255[%s]", addr_ctrl, port_ctrl, page_ctrl);
 	else
 		g_snprintf(scan_info, sizeof(scan_info),
-			   "%%[A-Za-z0-9.]:%%[0-9]/%%[A-Za-z0-9.~_-/&%%?=+^]");
+			   "%%255[%s]:%%5[%s]/%%255[%s]", addr_ctrl, port_ctrl, page_ctrl);
+	addr_ctrl[sizeof(addr_ctrl)-1] = '\0';
+	port_ctrl[sizeof(port_ctrl)-1] = '\0';
+	page_ctrl[sizeof(page_ctrl)-1] = '\0';
+
 	f = sscanf(url, scan_info, test->address, port, test->page);
 	if (f == 1) {
 		if (strstr(url, "http://"))
 			g_snprintf(scan_info, sizeof(scan_info),
-				   "http://%%[A-Za-z0-9.]/%%[A-Za-z0-9.~_-/&%%?=+^]");
+				   "http://%%255[%s]/%%255[%s]", addr_ctrl, page_ctrl);
 		else
 			g_snprintf(scan_info, sizeof(scan_info),
-				   "%%[A-Za-z0-9.]/%%[A-Za-z0-9.~_-/&%%?=+^]");
+				   "%%255[%s]/%%255[%s]", addr_ctrl, page_ctrl);
 		f = sscanf(url, scan_info, test->address, test->page);
+		addr_ctrl[sizeof(addr_ctrl)-1] = '\0';
+		page_ctrl[sizeof(page_ctrl)-1] = '\0';
 		g_snprintf(port, sizeof(test->port), "80");
 		port[2] = 0;
 	}
 	if (f == 1) {
 		if (strstr(url, "http://"))
-			g_snprintf(scan_info, sizeof(scan_info), "http://%%[A-Za-z0-9.]");
+			g_snprintf(scan_info, sizeof(scan_info),
+				  "http://%%255[%s]", addr_ctrl);
 		else
-			g_snprintf(scan_info, sizeof(scan_info), "%%[A-Za-z0-9.]");
+			g_snprintf(scan_info, sizeof(scan_info),
+				  "%%255[%s]", addr_ctrl);
+		addr_ctrl[sizeof(addr_ctrl)-1] = '\0';
 		f = sscanf(url, scan_info, test->address);
 		g_snprintf(test->page, sizeof(test->page), "%c", '\0');
 	}
+	if (f == 1)
+		*test->page = '\0';
 
 	sscanf(port, "%d", &test->port);
 	return test;