From 350e8fa3a94838bcc936782315b3472615fe6517 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 5 Oct 2010 22:01:19 +0000 Subject: http: raise empty backtrace for HttpParserError It's expensive to generate a backtrace and this exception is only triggered by bad clients. So make it harder for them to DoS us by sending bad requests. --- ext/unicorn_http/global_variables.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ext/unicorn_http/global_variables.h') diff --git a/ext/unicorn_http/global_variables.h b/ext/unicorn_http/global_variables.h index 7319bcd..8377704 100644 --- a/ext/unicorn_http/global_variables.h +++ b/ext/unicorn_http/global_variables.h @@ -35,13 +35,15 @@ static VALUE g_HEAD; static const char * const MAX_##N##_LENGTH_ERR = \ "HTTP element " # N " is longer than the " # length " allowed length." +NORETURN(static void parser_error(const char *)); + /** * Validates the max length of given input and throws an HttpParserError * exception if over. */ #define VALIDATE_MAX_LENGTH(len, N) do { \ if (len > MAX_##N##_LENGTH) \ - rb_raise(eHttpParserError, MAX_##N##_LENGTH_ERR); \ + parser_error(MAX_##N##_LENGTH_ERR); \ } while (0) /** Defines global strings in the init method. */ -- cgit v1.2.3-24-ge0c7