cmogstored dev/user discussion/issues/patches/etc
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: cmogstored-public@bogomips.org
Subject: [PATCH 2/1] http_parser: workaround parsing OOM in Ragel 6.10
Date: Fri, 7 Dec 2018 23:56:24 +0000	[thread overview]
Message-ID: <20181207235624.auo2azxknpwhcvtu@dcvr> (raw)
In-Reply-To: <20181127095936.30796-1-e@80x24.org>

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.
---
 http_parser.rl | 10 +++++-----
 path_parser.rl |  3 ++-
 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;
 }%%


      parent reply	other threads:[~2018-12-07 23:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27  9:59 [PATCH] serve /dev*/usage requests from memory Eric Wong
2018-11-28  0:19 ` Eric Wong
2018-12-07 23:56 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/cmogstored/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181207235624.auo2azxknpwhcvtu@dcvr \
    --to=e@80x24.org \
    --cc=cmogstored-public@bogomips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/cmogstored.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).