[smuxi/experiments/any_server_support: 19/34] Engine(-Tests): fixed matching uncommon but valid TLDs in DNS context



commit d48c9bcdeb06868d883e177738db64d4ceb6726d
Author: Mirco Bauer <meebey meebey net>
Date:   Tue Jan 21 07:42:23 2014 +0100

    Engine(-Tests): fixed matching uncommon but valid TLDs in DNS context

 src/Engine-Tests/MessageBuilderTests.cs     |    7 +++++++
 src/Engine/Config/MessageBuilderSettings.cs |    4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/Engine-Tests/MessageBuilderTests.cs b/src/Engine-Tests/MessageBuilderTests.cs
index f5020fb..4013ecf 100644
--- a/src/Engine-Tests/MessageBuilderTests.cs
+++ b/src/Engine-Tests/MessageBuilderTests.cs
@@ -540,6 +540,13 @@ namespace Smuxi.Engine
             builder.TimeStamp = DateTime.MinValue;
             builder.Append(new UrlMessagePartModel("http://en.wikipedia.org/Talk:Main_Page";));
             TestMessage(msg, builder.ToMessage());
+
+            msg = "<astronouth7303> ok, this is just trippy URL matching: http://couchdb.local/mydb/_magic";;
+            builder = new MessageBuilder();
+            builder.TimeStamp = DateTime.MinValue;
+            builder.Append(new TextMessagePartModel("<astronouth7303> ok, this is just trippy URL matching: 
"));
+            builder.Append(new UrlMessagePartModel("http://couchdb.local/mydb/_magic";));
+            TestMessage(msg, builder.ToMessage());
         }
 
         [Test]
diff --git a/src/Engine/Config/MessageBuilderSettings.cs b/src/Engine/Config/MessageBuilderSettings.cs
index b0ed78f..cf1da9c 100644
--- a/src/Engine/Config/MessageBuilderSettings.cs
+++ b/src/Engine/Config/MessageBuilderSettings.cs
@@ -69,8 +69,8 @@ namespace Smuxi.Engine
             string domainchars = @"[a-z0-9\-]+";
             string subdomain = domainchars + @"\.";
             string common_tld = @"de|es|im|us|com|net|org|info|biz|gov|name|edu|onion|museum";
-            string tld = common_tld + @"|[a-z][a-z]";
-            string domain = @"(?:(?:" + subdomain + ")+(?:" + tld + ")|localhost)";
+            string any_tld = @"[a-z]+";
+            string domain = @"(?:(?:" + subdomain + ")+(?:" + any_tld + ")|localhost)";
             string short_number = "[1-9][0-9]{,4}";
             string port = ":" + short_number;
             string user = "[a-z0-9._%+-]+@";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]