about summary refs log tree commit homepage
path: root/http_parser.rl
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-06-21 03:34:14 +0000
committerEric Wong <normalperson@yhbt.net>2013-06-25 21:25:28 +0000
commit89f0cf089b9e68730948ce652b42efaf26b98fd2 (patch)
tree674f2c0172f3612bf4e52422418ce6a3722dec6b /http_parser.rl
parent2376ed3c3da3bd2c9e8326e7dd75be2188fffc35 (diff)
downloadcmogstored-89f0cf089b9e68730948ce652b42efaf26b98fd2.tar.gz
This will allow us to do lookups for IO queues/semaphores before
we attempt to fstatat/stat a path.
Diffstat (limited to 'http_parser.rl')
-rw-r--r--http_parser.rl9
1 files changed, 5 insertions, 4 deletions
diff --git a/http_parser.rl b/http_parser.rl
index 364a984..0622d62 100644
--- a/http_parser.rl
+++ b/http_parser.rl
@@ -24,12 +24,12 @@ static bool length_incr(off_t *len, unsigned c)
 %%{
         machine http_parser;
         include http_common "http_common.rl";
+        include path_parser "path_parser.rl";
 
         ignored_header := header_name ':' sep header_value eor @ {
                 fgoto more_headers;
         };
 
-        mog_path = '/'[a-zA-Z0-9/\.\-]{0,36}; # only stuff MogileFS will use
         GET = "GET "> { http->_p.http_method = MOG_HTTP_METHOD_GET; };
         HEAD = "HEAD "> { http->_p.http_method = MOG_HTTP_METHOD_HEAD; };
         PUT = "PUT "> { http->_p.http_method = MOG_HTTP_METHOD_PUT; };
@@ -143,7 +143,8 @@ mog_http_parse(struct mog_http *http, char *buf, size_t len)
         char *p, *pe, *eof = NULL;
         int cs = http->cs;
         int really_done = 0;
-        size_t off = http->_p.offset;
+        size_t off = http->_p.buf_off;
+        uint32_t *mog_devid = &http->_p.mog_devid;
 
         assert(http->wbuf == NULL && "unwritten data in buffer");
         assert(off <= len && "http offset past end of buffer");
@@ -161,13 +162,13 @@ mog_http_parse(struct mog_http *http, char *buf, size_t len)
                 cs = http_parser_first_final;
 
         http->cs = cs;
-        http->_p.offset = p - buf;
+        http->_p.buf_off = p - buf;
 
         if (cs == http_parser_error || errno)
                 return MOG_PARSER_ERROR;
 
         assert(p <= pe && "buffer overflow after http parse");
-        assert(http->_p.offset <= len && "offset longer than len");
+        assert(http->_p.buf_off <= len && "offset longer than len");
 
         if (http->cs == http_parser_first_final) return MOG_PARSER_DONE;
         return MOG_PARSER_CONTINUE;