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

183 commits

Author SHA1 Message Date
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
Loïc Hoguin
f03dbf4d06 Use dialyzer directly instead of through rebar
Rebar recently removed their dialyzer support options so we're switching
to plain dialyzer. And as a bonus it works much better!
2011-06-21 17:24:07 +02:00
Loïc Hoguin
c427c7f8ec Merge remote-tracking branch 'skarab/listen-ip' 2011-06-21 17:17:09 +02:00
Hunter Morris
5f438561e9 Pass {ip, Ip} configuration through for TCP and SSL transports 2011-06-21 16:02:33 +01:00
Loïc Hoguin
a93eb02646 Fix a binary warning in cowboy_clock.
Just a change in the order of arguments of update_rfc1123.
2011-06-07 17:26:53 +02:00
Loïc Hoguin
648921b8cf Add hibernate support for websockets.
Return {ok, Req, State, hibernate}
or {reply, Data, Req, State, hibernate} to hibernate the websocket
process and save up memory and CPU. You should hibernate processes
that will receive few messages. So probably most of them.
2011-06-06 18:15:36 +02:00
Loïc Hoguin
b00dd6fba2 Add a 'profile' environment variable to start a profiler when the app starts. 2011-06-06 14:26:47 +02:00
Loïc Hoguin
2fa1e53928 Compile the binary match pattern for websockets only once. 2011-06-06 13:48:41 +02:00
Loïc Hoguin
919fa638ee Add function cowboy_http_req:compact/1 to regain memory.
It removes all the non-essential data from the HTTP request record.
It allows some applications to make better use of their memory,
for example websockets which do not need to keep all the headers
information and can simply discard it using this function.
2011-06-01 12:49:03 +02:00
Loïc Hoguin
3cfdf46e97 Remove a binary warning from websocket_data by removing a byte_size call. 2011-05-31 12:48:59 +02:00
Loïc Hoguin
ad2e905a81 Send a meaningful error to error_logger on websocket handler crashes.
Same as commit 4c4030a792 but for websockets.
See also issue #13 on github.
2011-05-27 12:32:02 +02:00
Loïc Hoguin
3e55cb62c9 Refresh the type specifications.
Following discussions on #erlounge.

Also fixes compilation in R14B03 and fixes a few underspecs
dialyzer warnings.
2011-05-25 23:02:40 +02:00
Loïc Hoguin
0720d6b9e3 Automatically start crypto, public_key and ssl if needed.
Following mochiweb and misultin's example here even though I'm not
too thrilled about starting them and not stopping but it's optional
and the application's author can start/stop them as normal anyway.
2011-05-24 20:52:19 +02:00
Loïc Hoguin
4c4030a792 Send a meaningful error to error_logger on handler crashes.
Inspired by gen_server and friends. Should fix issue #13.
2011-05-20 01:28:55 +02:00
Loïc Hoguin
548a9a15b8 README: Grammar fixes.
Thanks Mewn!
2011-05-16 12:36:52 +02:00
Loïc Hoguin
42111aa11f Merge remote-tracking branch 'nox/code-coverage' 2011-05-16 12:27:53 +02:00
Loïc Hoguin
4e4df58242 Makefile: Clean build the application before starting tests. 2011-05-16 12:16:26 +02:00
Loïc Hoguin
98b9b1124c Merge remote-tracking branch 'nox/path-info' 2011-05-16 12:08:55 +02:00
Anthony Ramine
107eba92a3 Enable code coverage 2011-05-16 11:42:15 +02:00
Anthony Ramine
4e09d776f5 Document the path info feature 2011-05-16 11:39:03 +02:00
Loïc Hoguin
9f06bac7bf Only try to update the Date field once every seconds. 2011-05-14 18:50:43 +02:00