Ver código fonte

Merge pull request #23 from WKJay/master

【修复】修复当基本认证目录设置为'/'时仍可访问 / 目录下的资源问题
aozima 4 anos atrás
pai
commit
8f979b018a
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      src/wn_utils.c

+ 3 - 2
src/wn_utils.c

@@ -40,8 +40,9 @@ rt_inline int tohex(char c)
 
 int str_path_with(const char *s, const char *t)
 {
-    if (strncasecmp(s, t, strlen(t)) == 0
-            && (strlen(s) == strlen(t) || *(s + strlen(t)) == '/')) return 1;
+    if ((strncasecmp(s, t, strlen(t)) == 0
+            && (strlen(s) == strlen(t) || *(s + strlen(t)) == '/'))
+        ||(strlen(t) == 1 && t[0] == '/')) return 1;
 
     return 0;
 }