commit edc8253: [Minor] One more trailing slash fix + tests

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Feb 18 17:35:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-02-18 17:32:09 +0000
URL: https://github.com/rspamd/rspamd/commit/edc8253e016cb823c08cbe81c47e536b6842f786 (HEAD -> master)

[Minor] One more trailing slash fix + tests

---
 src/libserver/http/http_util.c | 2 ++
 test/lua/unit/url.lua          | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/libserver/http/http_util.c b/src/libserver/http/http_util.c
index f9e5b3e77..ec9d9fa58 100644
--- a/src/libserver/http/http_util.c
+++ b/src/libserver/http/http_util.c
@@ -512,9 +512,11 @@ rspamd_http_normalize_path_inplace (gchar *path, guint len, guint *nlen)
 		*o++ = '/';
 		break;
 	default:
+#if 0
 		if (o > path + 1 && *(o - 1) == '/') {
 			o --;
 		}
+#endif
 		break;
 	}
 
diff --git a/test/lua/unit/url.lua b/test/lua/unit/url.lua
index 92709b365..583502c48 100644
--- a/test/lua/unit/url.lua
+++ b/test/lua/unit/url.lua
@@ -56,8 +56,8 @@ context("URL check functions", function()
   end
 
   cases = {
-    {[[http://example.net/path/.]], true, {
-      host = 'example.net', path = 'path'
+    {[[http://example.net/path/]], true, {
+      host = 'example.net', path = 'path/'
     }},
     {'http://example.net/hello%20world.php?arg=x#fragment', true, {
       host = 'example.net', fragment = 'fragment', query = 'arg=x',
@@ -146,8 +146,8 @@ context("URL check functions", function()
     {"/././foo", "/foo"},
     {"/a/b/c/./../../g", "/a/g"},
     {"/./.foo", "/.foo"},
-    {"/foo/.", "/foo"},
-    {"/foo/./", "/foo"},
+    {"/foo/.", "/foo/"},
+    {"/foo/./", "/foo/"},
     {"/foo/bar/..", "/foo"},
     {"/foo/bar/../", "/foo/"},
     {"/foo/..bar", "/foo/..bar"},


More information about the Commits mailing list