OSDN Git Service

#535 Fix: change sorry uri regex.
author0809216 <0809216@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Wed, 13 Oct 2010 06:01:32 +0000 (06:01 +0000)
committer0809216 <0809216@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Wed, 13 Oct 2010 06:01:32 +0000 (06:01 +0000)
git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-ramiel-epoll-cond@10363 1ed66053-1c2d-0410-8867-f7571e6e31d3

l7vsd/module/protocol/protocol_module_sessionless.cpp

index 6b0ee4e..e21138a 100644 (file)
@@ -300,14 +300,45 @@ protocol_module_base::check_message_result protocol_module_sessionless::check_pa
         bool forward_checked = false;
         bool sorryuri_checked = false;
         bool stats_checked = false;
+
+        // cf RFC 2396 (A. Collected BNF for URI)
         sregex    sorry_uri_regex
         =    +('/' >>
-               *(alpha |
-                 digit |
-                 (set = ';', ':', '@', '&', '=') |
-                 (set = '$', '-', '_', '.', '+') |
-                 (set = '!', '*', '\'', '\(', ')', ',') |
-                 '%' >> repeat<2>(xdigit)));
+               *(
+                 alpha | digit |
+                 (set = '-', '_', '.', '!', '~', '*', '\'', '(', ')') |
+                 '%' >> repeat<2>(xdigit) |
+                 (set = ':', '@', '&', '=', '+', '$', ',')
+               )
+               >>
+               *(';' >>
+                 *(
+                   alpha | digit |
+                   (set = '-', '_', '.', '!', '~', '*', '\'', '(', ')') | // mark
+                   '%' >> repeat<2>(xdigit) | // escaped
+                   (set = ':', '@', '&', '=', '+', '$', ',')
+                 ) // pchar
+               ) // param
+             ) // segment
+             >>
+             !('?' >>
+               *(
+                 (set = ';', '/', '?', ':', '@', '&', '=', '+', '$', ',') | //reserved
+                 alpha | digit |
+                 (set = '-', '_', '.', '!', '~', '*', '\'', '(', ')') | // mark
+                 '%' >> repeat<2>(xdigit) // escaped
+               ) // uric
+             ) // query
+             >>
+             !('#' >>
+               *(
+                 (set = ';', '/', '?', ':', '@', '&', '=', '+', '$', ',') | //reserved
+                 alpha | digit |
+                 (set = '-', '_', '.', '!', '~', '*', '\'', '(', ')') | // mark
+                 '%' >> repeat<2>(xdigit) // escaped
+               ) // uric
+             ); // fragment
+
         typedef std::vector<std::string>::const_iterator vec_str_it;
 
         try {
@@ -512,14 +543,44 @@ protocol_module_base::check_message_result protocol_module_sessionless::set_para
         bool forward_checked = false;
         bool sorryuri_checked = false;
         bool stats_checked = false;
+
+        // cf RFC 2396 (A. Collected BNF for URI)
         sregex    sorry_uri_regex
         =    +('/' >>
-               *(alpha |
-                 digit |
-                 (set = ';', ':', '@', '&', '=') |
-                 (set = '$', '-', '_', '.', '+') |
-                 (set = '!', '*', '\'', '\(', ')', ',') |
-                 '%' >> repeat<2>(xdigit)));
+               *(
+                 alpha | digit |
+                 (set = '-', '_', '.', '!', '~', '*', '\'', '(', ')') |
+                 '%' >> repeat<2>(xdigit) |
+                 (set = ':', '@', '&', '=', '+', '$', ',')
+               )
+               >>
+               *(';' >>
+                 *(
+                   alpha | digit |
+                   (set = '-', '_', '.', '!', '~', '*', '\'', '(', ')') | // mark
+                   '%' >> repeat<2>(xdigit) | // escaped
+                   (set = ':', '@', '&', '=', '+', '$', ',')
+                 ) // pchar
+               ) // param
+             ) // segment
+             >>
+             !('?' >>
+               *(
+                 (set = ';', '/', '?', ':', '@', '&', '=', '+', '$', ',') | //reserved
+                 alpha | digit |
+                 (set = '-', '_', '.', '!', '~', '*', '\'', '(', ')') | // mark
+                 '%' >> repeat<2>(xdigit) // escaped
+               ) // uric
+             ) // query
+             >>
+             !('#' >>
+               *(
+                 (set = ';', '/', '?', ':', '@', '&', '=', '+', '$', ',') | //reserved
+                 alpha | digit |
+                 (set = '-', '_', '.', '!', '~', '*', '\'', '(', ')') | // mark
+                 '%' >> repeat<2>(xdigit) // escaped
+               ) // uric
+             ); // fragment
 
         typedef std::vector<std::string>::const_iterator vec_str_it;