0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 04:10:24 +00:00
Commit graph

2203 commits

Author SHA1 Message Date
Loïc Hoguin
986630d9ad Get rid of a binary construct in cowboy_http_websocket
Thanks to @nivertech for pointing it out in ticket #61.
2011-10-01 19:08:32 +02:00
Loïc Hoguin
b79e9fbeb4 Get rid of a binary construct in cowboy_http_req
Thanks to @klaar for pointing it out in ticket #59.
2011-10-01 18:54:43 +02:00
Loïc Hoguin
ce26d7090b Rename the type cowboy_dispatcher:path_tokens/0 to :tokens/0 2011-10-01 02:32:20 +02:00
Loïc Hoguin
6572d4d374 Merge branch 'path-split-doc' of https://github.com/klaar/cowboy 2011-10-01 02:24:38 +02:00
Loïc Hoguin
76f855ebd0 Merge branch 'master' of https://github.com/hakvroot/cowboy 2011-10-01 02:10:10 +02:00
Michiel Hakvoort
d8e841c8a2 Add cowboy_protocol behaviour 2011-09-30 08:49:58 +02:00
Magnus Klaar
973e67a53c add note to split_path/1 and path/1 on escaped / 2011-09-29 23:13:00 +02:00
Loïc Hoguin
eff9477201 Improve the error message for HTTP handlers
Making it look more like the websocket handler error messages.
2011-09-28 18:01:35 +02:00
Loïc Hoguin
0e84e7f920 Merge remote-tracking branch 'smarkets/cacertfile' 2011-09-28 15:02:08 +02:00
Steven Gravell
ea5780b7cd add cacertfile configuration 2011-09-28 13:40:09 +01:00
Loïc Hoguin
b675fb2ab1 Merge remote-tracking branch 'nivertech/master' 2011-09-26 19:59:44 +02:00
Ori Bar
3715df5bd4 Fix handshake for when querystring is needed 2011-09-26 19:57:46 +02:00
Loïc Hoguin
d0f711a61d Add a test for websocket hibernate + timeout and fix this use case
The issue was that we were calling erlang:hibernate before a
receive .. after .. end call. Erlang hibernates the process before
reaching the receive instruction and we therefore couldn't enter
the after clause when hibernating.

This is now fixed by using erlang:send_after instead and receiving
that message instead of using an after clause.
2011-09-22 23:15:54 +02:00
Loïc Hoguin
04f55eb3c9 Allow websocket handlers to hibernate from the websocket_init/3 function
Also improve the documentation about hibernate.
2011-09-15 23:20:02 +02:00
Loïc Hoguin
89ae3c8cad 'Host' header is optional in HTTP/1.0
Krishnamurthy, Kristol, Mogul: "Key Differences between HTTP/1.0
and HTTP/1.1", "Internet address conservation".
http://www8.org/w8-papers/5c-protocols/key/key.html

Fixes issue #35 reported by Alex Kropivny.
2011-09-14 01:45:12 +02:00
Loïc Hoguin
b669b1b5a3 Reset the max number of empty lines between keepalive requests
Fixes issue #47.
2011-09-13 23:41:34 +02:00
Loïc Hoguin
961526d704 Improve the Cowboy definition in the README 2011-09-13 23:10:41 +02:00
Loïc Hoguin
55ba8dc4da Merge pull request #46 from tillitech/master
Fix the handling of HEAD requests
2011-09-06 03:24:53 -07:00
Ali Sabil
bb469f6c3d Fix the handling of the HEAD requests
Responses to the HEAD requests used to include an response body.
2011-09-06 12:11:44 +02:00
Loïc Hoguin
8bb7472fb0 Update version to 0.3.0 to continue with development 2011-09-05 15:51:53 +02:00
Loïc Hoguin
009ad4c9eb Update version to 0.2.0 2011-09-05 15:45:19 +02:00
Loïc Hoguin
2a25ad6c24 Update AUTHORS file 2011-09-05 15:41:13 +02:00
Loïc Hoguin
a1d6c2e66f Tweak the .travis.yml file
We want to run 'make tests' and not that rebar command.
Also remove R14B as quoted doesn't work with it.
2011-09-05 14:22:36 +02:00
Loïc Hoguin
24f3981377 Add .travis.yml file 2011-09-05 14:14:30 +02:00
Loïc Hoguin
2374aa7e07 Add WebSocket drafts 7, 8, 9 and 10 implementation
The implementation is only partial for now but should work for
all browsers implementing it.
2011-08-23 23:49:58 +02:00
Loïc Hoguin
24bf2c54d0 Ensure header names are handled in a case insensitive manner
To this end we are formatting the header names just like OTP does
except we do it for names of up to 32 characters, as there are
widely used header names of more than 20 characters, the limit that
OTP follows currently. An example of such header name would be
Sec-Websocket-Version.

The formatting itself is fairly simple: an uppercase character at
the start and after dashes, everything else lowercase.
2011-08-23 16:20:53 +02:00
Loïc Hoguin
d858153fce Use cowboy_clock types in cowboy_cookies instead of calendar
Until calendar exports them at least.
2011-08-11 10:24:50 +02:00
Loïc Hoguin
cd06efeba3 Add Transport:setopts/2 note for writing protocols 2011-08-11 09:46:39 +02:00
Loïc Hoguin
43d14b52cd Give the ListenerPid to the protocol on startup
Also sends a message 'shoot' that can be received by the protocol
to make sure Cowboy has had enough time to fully initialize the
socket. This message should be received before any socket-related
operations are performed.

WebSocket request connections are now moved from the pool 'default'
to the pool 'websocket', meaning we can have a lot of running
WebSockets despite having a low 'max_connections' setting.
2011-08-10 20:28:30 +02:00
Loïc Hoguin
56369d5c1a Introduce cowboy_listener for managing a listener
Currently only supports limiting the maximum number of
connections by managing connection pools.
2011-08-10 16:43:59 +02:00
Loïc Hoguin
6138901465 Fix cookie tests and specs 2011-07-26 17:39:41 +02:00
Loïc Hoguin
528d0ebffd Small cosmetic changes and doc update to the cookie patch 2011-07-26 13:58:48 +02:00
Tom Burdick
b75859e075 Fail early in cookie-related API functions 2011-07-26 13:53:52 +02:00
Tom Burdick
5bd936db66 Implement cookies in cowboy_http_req 2011-07-26 13:53:31 +02:00
Tom Burdick
a29ccb070b Add cowboy_cookies for cookie creation and parsing
Based on Mochi Media, Inc.'s work in Mochiweb.

Conflicts:

	rebar.config
2011-07-26 13:52:21 +02:00
Loïc Hoguin
acc5f50ab5 Update quoted to 1.0.3 to fix outstanding issues
Magnus Klaar updated the PropEr tests and it should be fine now.
2011-07-26 12:36:35 +02:00
Loïc Hoguin
e5d4c1f22f Add a PropEr test for cowboy_dispatcher:split_host/1
Mostly thanks to Magnus Klaar as it took me a while to figure
out how PropEr tests had to be written.
2011-07-26 10:46:06 +02:00
Loïc Hoguin
503a0c7662 URL decode paths
This fixes issue #33.
2011-07-20 22:07:35 +02:00
Loïc Hoguin
fa20273b37 URL decode query strings
Should be good for both GET and POST query strings.

This adds https://github.com/klaar/quoted.erl as a dependency.
Props to klaar for this code.
2011-07-20 17:38:10 +02:00
Loïc Hoguin
293cf33702 Separate message and packet handling for websockets
Improves the readability of websocket handler code by having
two functions: websocket_handle/3 handles the packets received
from the socket, removing the tuple construct that was otherwise
needed, so only websocket_handle(Data, Req, State) is needed now;
websocket_info/3 handles the messages that the websocket handler
process received, as websocket_info(Info, Req, State).

Both functions return values are handled identically by Cowboy
so nothing changes on that end.
2011-07-19 12:20:16 +02:00
Loïc Hoguin
d363f91410 Fail fast when a wrong type is given to API functions
Idea given by bfrog, fixes issue #34.
2011-07-18 14:21:45 +02:00
Loïc Hoguin
87366e36ad Call websocket_close/4 *after* throwing the error
This ensures that an error thrown in handler_terminate/4 will be
shown after the error from handler_call/6, in the expected order.

As we already call WebSocketHandler:terminate/3, this should
fix issue #23.
2011-07-07 17:50:46 +02:00
Loïc Hoguin
474f4e0bfa Call Handler:terminate/2 even on error in Handler:handle/2
This ensures we can cleanup what we did in Handler:init/3.
2011-07-07 17:45:28 +02:00
Loïc Hoguin
aa0a66749e Move recursion out of a try .. catch block.
Fixes issue #31.

Recursion shouldn't happen in a single catch statement or inside
a try .. catch statement. The only safe construct for catching
exceptions and perform recursion when everything goes well is
to put the recursive call inside a try .. of .. catch construct
in the of .. catch block.

Otherwise the stack gets filled with exception-related information
since they can still be caught if we were to send them and unfold
the whole thing.

Thanks go to lpgauth for reporting the issue and people on IRC
for explaining the hows and whys.
2011-07-06 20:00:08 +02:00
Loïc Hoguin
108a491f55 Add documentation for the public interface.
This is probably not perfect yet but it should be better than
nothing. We'll improve things with feedback received from the
many users.
2011-07-06 17:42:20 +02:00
Loïc Hoguin
2b3bfdd783 Add a link to cowboy_examples in the README 2011-06-30 14:04:06 +02:00
Loïc Hoguin
6b1fb5f390 Fix the @equiv EDoc tags 2011-06-30 01:11:11 +02:00
Loïc Hoguin
58267689f0 Add the remaining missing specs
Found thanks to warn_missing_spec and added with the help of typer.
Eunit functions do not have specs yet however.
2011-06-27 23:36:17 +02:00
Loïc Hoguin
227529761c Merge pull request #29 from smarkets/ws-default-ports
do not send ports 80 and 443 - browsers get mad
2011-06-27 07:06:34 -07:00
Steven Gravell
bebe3dc5d2 do not send ports 80 and 443 - browsers get mad
Browsers get mad that the returned location address is not the same
as what they sent, since the :(80|443) is stripped.

Add a simple eunit test due to existing ct websockets tests not
covering this case.
2011-06-27 15:25:30 +01:00