mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 20:50:24 +00:00
Add cowboy_http_req:port/1.
Returns the port given in the Host header if present, otherwise the default port of 443 for HTTPS and 80 for HTTP is returned.
This commit is contained in:
parent
cc663df5db
commit
6c1f73c53c
6 changed files with 84 additions and 43 deletions
|
@ -199,7 +199,7 @@ websocket(Config) ->
|
|||
[Headers, Body] = websocket_headers(erlang:decode_packet(httph, Rest, []), []),
|
||||
{'Connection', "Upgrade"} = lists:keyfind('Connection', 1, Headers),
|
||||
{'Upgrade', "WebSocket"} = lists:keyfind('Upgrade', 1, Headers),
|
||||
{"sec-websocket-location", "ws://localhost/websocket"}
|
||||
{"sec-websocket-location", "ws://localhost:80/websocket"}
|
||||
= lists:keyfind("sec-websocket-location", 1, Headers),
|
||||
{"sec-websocket-origin", "http://localhost"}
|
||||
= lists:keyfind("sec-websocket-origin", 1, Headers),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue