about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2018-12-07 23:56:24 +0000
committerEric Wong <e@80x24.org>2018-12-08 00:04:45 +0000
commitbd144a77fae53a2c02f2ccda7e309ff46f739fb2 (patch)
tree4746ee286a0d5e0cc8ac843247ff2e1935397715
parent86ace01fed5ed39a48e6d21810fec93f976baa97 (diff)
downloadcmogstored-bd144a77fae53a2c02f2ccda7e309ff46f739fb2.tar.gz
Noticed in FreeBSD 11.2 where Ragel 6.10 was OOM-ing, this
doesn't affect Ragel 6.9.

TODO: make sure this is fixed upstream in Ragel.
-rw-r--r--http_parser.rl10
-rw-r--r--path_parser.rl3
2 files changed, 7 insertions, 6 deletions
diff --git a/http_parser.rl b/http_parser.rl
index 4ecb97a..e07aea8 100644
--- a/http_parser.rl
+++ b/http_parser.rl
@@ -48,16 +48,16 @@ static char *skip_header(struct mog_http *http, char *buf, const char *pe)
         DELETE = "DELETE "> { http->_p.http_method = MOG_HTTP_METHOD_DELETE; };
         MKCOL = "MKCOL "> { http->_p.http_method = MOG_HTTP_METHOD_MKCOL; };
 
-        mog_fs_path = (mog_path) > { http->_p.path_tip = to_u8(fpc - buf); }
+        mog_path_start = '/' > { http->_p.path_tip = to_u8(fpc - buf); };
                 # TODO: maybe folks use query string/fragments for logging...
-                (" HTTP/1.") > { http->_p.path_end = to_u8(fpc - buf); };
-
-        usage_path = ('/' devid "usage HTTP/1.") @ { http->_p.usage_txt = 1; };
+        mog_path_end = (" HTTP/1.") > { http->_p.path_end = to_u8(fpc - buf); };
+        usage_path = ("usage HTTP/1.") @ { http->_p.usage_txt = 1; };
 
         # no HTTP/0.9 for now, sorry (not :P)
         req_line = (HEAD|GET|PUT|DELETE|MKCOL)
                 ("http://" [^/]+)?
-                '/'*(usage_path | mog_fs_path)
+                '/'* mog_path_start devid? (usage_path |
+                                            (mog_path_rest mog_path_end) )
                 ('0'|'1'> { http->_p.persistent = 1; }) '\r'LF;
 
         content_length = "Content-Length:"i sep
diff --git a/path_parser.rl b/path_parser.rl
index 4f0b3ec..974b6c6 100644
--- a/path_parser.rl
+++ b/path_parser.rl
@@ -17,5 +17,6 @@
                 }
                 '/';
         # only stuff MogileFS will use
-        mog_path = '/' (devid)? [a-zA-Z0-9/\.\-]{0,36};
+        mog_path_rest = [a-zA-Z0-9/\.\-]{0,36};
+        mog_path = '/' (devid)? mog_path_rest;
 }%%