From 77a951c5da518dda471282635c98f3b572ca15db Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 5 May 2011 16:42:26 -0700 Subject: http_parser: add max_header_len accessor Rainbows! wants to be able to lower this eventually... --- ext/unicorn_http/global_variables.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (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 cda7f24..aa0d777 100644 --- a/ext/unicorn_http/global_variables.h +++ b/ext/unicorn_http/global_variables.h @@ -1,7 +1,8 @@ #ifndef global_variables_h #define global_variables_h static VALUE eHttpParserError; -static VALUE eRequestURITooLongError; +static VALUE e413; +static VALUE e414; static VALUE g_rack_url_scheme; static VALUE g_request_method; @@ -36,8 +37,7 @@ static VALUE g_http_11; 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 *)); -NORETURN(static void raise_414(const char *)); +NORETURN(static void parser_raise(VALUE klass, const char *)); /** * Validates the max length of given input and throws an HttpParserError @@ -45,12 +45,12 @@ NORETURN(static void raise_414(const char *)); */ #define VALIDATE_MAX_LENGTH(len, N) do { \ if (len > MAX_##N##_LENGTH) \ - parser_error(MAX_##N##_LENGTH_ERR); \ + parser_raise(eHttpParserError, MAX_##N##_LENGTH_ERR); \ } while (0) #define VALIDATE_MAX_URI_LENGTH(len, N) do { \ if (len > MAX_##N##_LENGTH) \ - raise_414(MAX_##N##_LENGTH_ERR); \ + parser_raise(e414, MAX_##N##_LENGTH_ERR); \ } while (0) /** Defines global strings in the init method. */ @@ -66,7 +66,6 @@ DEF_MAX_LENGTH(REQUEST_URI, 1024 * 12); DEF_MAX_LENGTH(FRAGMENT, 1024); /* Don't know if this length is specified somewhere or not */ DEF_MAX_LENGTH(REQUEST_PATH, 1024); DEF_MAX_LENGTH(QUERY_STRING, (1024 * 10)); -DEF_MAX_LENGTH(HEADER, (1024 * (80 + 32))); static void init_globals(void) { -- cgit v1.2.3-24-ge0c7