summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-01-16 14:06:50 -0800
committerTingPing <tingping@tingping.se>2013-01-16 14:06:50 -0800
commit8b451edf9c756a59196058d2f6cf2211bed5e60d (patch)
tree58b15a287444969b9fed3bd336324a7b7c772197
parentea92a70e6468c88513c4ee6bc61380adbab1d6a5 (diff)
parent7bc0e017f6de8a8f05e9d6202fe8737e2eb75c60 (diff)
Merge pull request #377 from RichardHitt/issue376
Parse url according to rfc 1738: add separate define for TLD.  Closes 376.
-rw-r--r--src/common/url.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common/url.c b/src/common/url.c
index f22da931..c183a5c8 100644
--- a/src/common/url.c
+++ b/src/common/url.c
@@ -347,9 +347,10 @@ do_an_re(const char *word,int *start, int *end, int *type)
 }
 
 /*	Miscellaneous description --- */
-#define DOMAIN "[-a-z0-9]+(\\.[-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]+(\\.[0-9]+){3}"
-#define HOST "(" DOMAIN "|" IPADDR ")"
+#define HOST "(" DOMAIN TLD "|" IPADDR ")"
 #define OPT_PORT "(:[1-9][0-9]{0,4})?"
 
 GRegex *