mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-16 13:10:24 +00:00
Don't use decode_packet/3 for parsing the request-line
First step in making all methods and header names binaries to get rid of many inconsistencies caused by decode_packet/3. Methods are all binary now. Note that since they are case sensitive, the usual methods become <<"GET">>, <<"POST">> and so on.
This commit is contained in:
parent
f6791b008a
commit
8497c8bbcd
10 changed files with 147 additions and 107 deletions
|
@ -327,17 +327,17 @@ check_raw_status(Config) ->
|
|||
HugeCookie = lists:flatten(["whatever_man_biiiiiiiiiiiig_cookie_me_want_77="
|
||||
"Wed Apr 06 2011 10:38:52 GMT-0500 (CDT)" || _ <- lists:seq(1, 40)]),
|
||||
ResponsePacket =
|
||||
"HTTP/1.0 302 Found
|
||||
Location: http://www.google.co.il/
|
||||
Cache-Control: private
|
||||
Content-Type: text/html; charset=UTF-8
|
||||
Set-Cookie: PREF=ID=568f67013d4a7afa:FF=0:TM=1323014101:LM=1323014101:S=XqctDWC65MzKT0zC; expires=Tue, 03-Dec-2013 15:55:01 GMT; path=/; domain=.google.com
|
||||
Date: Sun, 04 Dec 2011 15:55:01 GMT
|
||||
Server: gws
|
||||
Content-Length: 221
|
||||
X-XSS-Protection: 1; mode=block
|
||||
X-Frame-Options: SAMEORIGIN
|
||||
|
||||
"HTTP/1.0 302 Found\r
|
||||
Location: http://www.google.co.il/\r
|
||||
Cache-Control: private\r
|
||||
Content-Type: text/html; charset=UTF-8\r
|
||||
Set-Cookie: PREF=ID=568f67013d4a7afa:FF=0:TM=1323014101:LM=1323014101:S=XqctDWC65MzKT0zC; expires=Tue, 03-Dec-2013 15:55:01 GMT; path=/; domain=.google.com\r
|
||||
Date: Sun, 04 Dec 2011 15:55:01 GMT\r
|
||||
Server: gws\r
|
||||
Content-Length: 221\r
|
||||
X-XSS-Protection: 1; mode=block\r
|
||||
X-Frame-Options: SAMEORIGIN\r
|
||||
\r
|
||||
<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">
|
||||
<TITLE>302 Moved</TITLE></HEAD><BODY>
|
||||
<H1>302 Moved</H1>
|
||||
|
|
|
@ -10,7 +10,7 @@ rest_init(Req, [Forbidden]) ->
|
|||
{ok, Req, Forbidden}.
|
||||
|
||||
allowed_methods(Req, State) ->
|
||||
{['GET', 'HEAD', 'POST'], Req, State}.
|
||||
{[<<"GET">>, <<"HEAD">>, <<"POST">>], Req, State}.
|
||||
|
||||
forbidden(Req, State=true) ->
|
||||
{true, Req, State};
|
||||
|
|
|
@ -6,7 +6,7 @@ init(_Transport, _Req, _Opts) ->
|
|||
{upgrade, protocol, cowboy_rest}.
|
||||
|
||||
allowed_methods(Req, State) ->
|
||||
{['GET', 'HEAD', 'DELETE'], Req, State}.
|
||||
{[<<"GET">>, <<"HEAD">>, <<"DELETE">>], Req, State}.
|
||||
|
||||
|
||||
content_types_provided(Req, State) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue