summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnton Backer <olegov@gmail.com>2013-07-19 09:01:53 -0400
committerAnton Backer <olegov@gmail.com>2013-07-19 09:01:53 -0400
commitbca972bdc3d5a0d3e176dccbb706c35f9be261a4 (patch)
treed68b1616ad13aad76a2b52bbe8ab140db4181e27
parent2e2f4662f3bc3d97d7103cc0f4e2bd1dbe2278f0 (diff)
Permit dot-less domain names
Fixes #523
-rw-r--r--src/common/url.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/common/url.c b/src/common/url.c
index 10479127..892441c8 100644
--- a/src/common/url.c
+++ b/src/common/url.c
@@ -350,8 +350,8 @@ do_an_re(const char *word, int *start, int *end, int *type)
 }
 
 /*	Miscellaneous description --- */
-#define DOMAIN "[a-z0-9][-a-z0-9]*(\\.[-a-z0-9]+)*\\."
-#define TLD "[a-z][-a-z0-9]*[a-z]"
+#define DOMAIN "[a-z0-9][-a-z0-9]*(\\.[-a-z0-9]+)*"
+#define TLD "\\.[a-z][-a-z0-9]*[a-z]"
 #define IPADDR "[0-9]{1,3}(\\.[0-9]{1,3}){3}"
 #define IPV6GROUP "([0-9a-f]{0,4})"
 #define IPV6ADDR "((" IPV6GROUP "(:" IPV6GROUP "){7})"	\
@@ -359,6 +359,7 @@ do_an_re(const char *word, int *start, int *end, int *type)
 #define HOST "(" DOMAIN TLD "|" IPADDR "|" IPV6ADDR ")"
 /* In urls the IPv6 must be enclosed in square brackets */
 #define HOST_URL "(" DOMAIN TLD "|" IPADDR "|" "\\[" IPV6ADDR "\\]" ")"
+#define HOST_URL_OPT_TLD "(" DOMAIN "|" HOST_URL ")"
 #define PORT "(:[1-9][0-9]{0,4})"
 #define OPT_PORT "(" PORT ")?"
 
@@ -517,7 +518,7 @@ re_url (void)
 			g_string_append (grist_gstr, USERINFO "?");
 
 		if (uri[i].flags & URI_AUTHORITY)
-			g_string_append (grist_gstr, HOST_URL OPT_PORT);
+			g_string_append (grist_gstr, HOST_URL_OPT_TLD OPT_PORT);
 		
 		if (uri[i].flags & URI_PATH)
 		{