diff options
Diffstat (limited to 'ext/unicorn_http/global_variables.h')
-rw-r--r-- | ext/unicorn_http/global_variables.h | 11 |
1 files changed, 5 insertions, 6 deletions
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) { |