ninenines / cowboy

Small, fast, modern HTTP server for Erlang/OTP.
https://ninenines.eu
ISC License
7.29k stars 1.17k forks source link

Add host and scheme names case-insensitive support #473

Closed AntonSizov closed 11 years ago

AntonSizov commented 11 years ago

As I figured out, cowboy 0.8.2 doesn't support case-insensitive host and scheme names as described in rfc2616 and rfc1945 What are the reasons for such implementation?

essen commented 11 years ago

The host is lowercased and we don't have the scheme at all. What do you mean exactly?

dvv commented 11 years ago

Connected to missing scheme -- that's how i have to deal with that -- https://github.com/dvv/social/blob/master/src/cowboy_social.erl#L18-L28 . Currently, cowboy relies on transport to guess scheme, which is not enough in case of cowboy behind an SSL terminator.

essen commented 11 years ago

Don't think Cowboy can guess behind what it's running.

Vladimir Dronnikov notifications@github.com wrote:

Connected to missing scheme -- that's how i have to deal with that -- https://github.com/dvv/social/blob/master/src/cowboy_social.erl#L18-L28 . Currently, cowboy relies on transport to guess scheme, which is not enough in case of cowboy behind an SSL terminator.

— Reply to this email directly or view it on GitHub.

dvv commented 11 years ago

But it guesses IP:

{ForwardedForRaw, Req2} = header(<<"x-forwarded-for">>, Req1),

;)

essen commented 11 years ago

Yeah but that's non standard and the peer_addr function that uses it will be removed soon too.

Vladimir Dronnikov notifications@github.com wrote:

But it guesses IP:

{ForwardedForRaw, Req2} = header(<<"x-forwarded-for">>, Req1),

;)

— Reply to this email directly or view it on GitHub.

AntonSizov commented 11 years ago

Sorry. I misread specification and misunderstood what scheme exactly means. The question was about does http://mysite.com/path/to/resource match the http://mysite.com/PATH/TO/Resource Now I figured out that it doesn't as section 3.2.3 of rfc2616 says.

Will the function peer/1 be removed as well as peer_addr/1? Will there a possibility to figure out a peer addr after you remove those functions?

essen commented 11 years ago

Oh the path, yeah it's not insensitive.

peer/1 stays, peer_addr/1 remains and will have the header parsing code added to parse_header instead so you can easily write the function the way you need it.

AntonSizov commented 11 years ago

Thx