From ed4f50016ab0eab1ebbeac2fe1d0fd8712c7ee91 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 21 Apr 2009 11:14:39 -0700 Subject: Move absolute URI parsing into HTTP parser It's part of the HTTP/1.1 (rfc2616), so we might as well handle it in there and set PATH_INFO while we're at it. Also, make "OPTIONS *" test not fail Rack::Lint --- ext/unicorn/http11/http11_parser.rl | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ext/unicorn/http11/http11_parser.rl') diff --git a/ext/unicorn/http11/http11_parser.rl b/ext/unicorn/http11/http11_parser.rl index a86e8cd..a9f7a39 100644 --- a/ext/unicorn/http11/http11_parser.rl +++ b/ext/unicorn/http11/http11_parser.rl @@ -19,6 +19,12 @@ static void snake_upcase_char(char *c) *c = '_'; } +static void downcase_char(char *c) +{ + if (*c >= 'A' && *c <= 'Z') + *c |= 0x20; +} + #define LEN(AT, FPC) (FPC - buffer - parser->AT) #define MARK(M,FPC) (parser->M = (FPC) - buffer) #define PTR_TO(F) (buffer + parser->F) @@ -34,6 +40,7 @@ static void snake_upcase_char(char *c) action start_field { MARK(field_start, fpc); } action snake_upcase_field { snake_upcase_char((char *)fpc); } + action downcase_char { downcase_char((char *)fpc); } action write_field { parser->field_len = LEN(field_start, fpc); } -- cgit v1.2.3-24-ge0c7