diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-10-05 22:01:19 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-10-05 22:08:21 +0000 |
commit | 350e8fa3a94838bcc936782315b3472615fe6517 (patch) | |
tree | 2e989526cc59d071be5a91fd124a461dbb2ddd4d /ext/unicorn_http/global_variables.h | |
parent | c2975b85b9378797631d3ab133cac371f9fadf54 (diff) | |
download | unicorn-350e8fa3a94838bcc936782315b3472615fe6517.tar.gz |
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.
Diffstat (limited to 'ext/unicorn_http/global_variables.h')
-rw-r--r-- | ext/unicorn_http/global_variables.h | 4 |
1 files changed, 3 insertions, 1 deletions
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. */ |