aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2011-07-26Add a PropEr test for cowboy_dispatcher:split_host/1Loïc Hoguin
Mostly thanks to Magnus Klaar as it took me a while to figure out how PropEr tests had to be written.
2011-07-20URL decode pathsLoïc Hoguin
This fixes issue #33.
2011-07-20URL decode query stringsLoïc Hoguin
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-19Separate message and packet handling for websocketsLoïc Hoguin
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-18Fail fast when a wrong type is given to API functionsLoïc Hoguin
Idea given by bfrog, fixes issue #34.
2011-07-07Call websocket_close/4 *after* throwing the errorLoïc Hoguin
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-07Call Handler:terminate/2 even on error in Handler:handle/2Loïc Hoguin
This ensures we can cleanup what we did in Handler:init/3.
2011-07-06Move recursion out of a try .. catch block.Loïc Hoguin
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-06Add documentation for the public interface.Loïc Hoguin
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-06-30Add a link to cowboy_examples in the READMELoïc Hoguin
2011-06-30Fix the @equiv EDoc tagsLoïc Hoguin
2011-06-27Add the remaining missing specsLoïc Hoguin
Found thanks to warn_missing_spec and added with the help of typer. Eunit functions do not have specs yet however.
2011-06-27Merge pull request #29 from smarkets/ws-default-portsLoïc Hoguin
do not send ports 80 and 443 - browsers get mad
2011-06-27do not send ports 80 and 443 - browsers get madSteven Gravell
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-21Use dialyzer directly instead of through rebarLoïc Hoguin
Rebar recently removed their dialyzer support options so we're switching to plain dialyzer. And as a bonus it works much better!
2011-06-21Merge remote-tracking branch 'skarab/listen-ip'Loïc Hoguin
2011-06-21Pass {ip, Ip} configuration through for TCP and SSL transportsHunter Morris
2011-06-07Fix a binary warning in cowboy_clock.Loïc Hoguin
Just a change in the order of arguments of update_rfc1123.
2011-06-06Add hibernate support for websockets.Loïc Hoguin
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-06Add a 'profile' environment variable to start a profiler when the app starts.Loïc Hoguin
2011-06-06Compile the binary match pattern for websockets only once.Loïc Hoguin
2011-06-01Add function cowboy_http_req:compact/1 to regain memory.Loïc Hoguin
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-05-31Remove a binary warning from websocket_data by removing a byte_size call.Loïc Hoguin
2011-05-27Send a meaningful error to error_logger on websocket handler crashes.Loïc Hoguin
Same as commit 4c4030a792a94d96f8bda5076fcfdc03a590030e but for websockets. See also issue #13 on github.
2011-05-25Refresh the type specifications.Loïc Hoguin
Following discussions on #erlounge. Also fixes compilation in R14B03 and fixes a few underspecs dialyzer warnings.
2011-05-24Automatically start crypto, public_key and ssl if needed.Loïc Hoguin
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-20Send a meaningful error to error_logger on handler crashes.Loïc Hoguin
Inspired by gen_server and friends. Should fix issue #13.
2011-05-16README: Grammar fixes.Loïc Hoguin
Thanks Mewn!
2011-05-16Merge remote-tracking branch 'nox/code-coverage'Loïc Hoguin
2011-05-16Makefile: Clean build the application before starting tests.Loïc Hoguin
2011-05-16Merge remote-tracking branch 'nox/path-info'Loïc Hoguin
2011-05-16Enable code coverageAnthony Ramine
2011-05-16Document the path info featureAnthony Ramine
2011-05-14Only try to update the Date field once every seconds.Loïc Hoguin
2011-05-14Add the Server header in the HTTP replies.Loïc Hoguin
2011-05-14Add the required Date header in the HTTP replies.Loïc Hoguin
The formatted date is generated and kept up to date regularly by a gen_server process storing it in the cowboy_clock ets table. Then it is retrieved by other processes simply by reading the table.
2011-05-09Add a max_connections transport option.Loïc Hoguin
Limits the number of parallel requests processed at once. Waiting requests are kept in the accept queue. The limit is not explicitly observed, but it should be around the given value at any time. Defaults to 1024. Thanks to ostinelli's benchmark to point out the issue hopefully solved by this and the previous commit.
2011-05-09Increase the default backlog from 128 to 1024.Loïc Hoguin
Improves reliability under heavy load.
2011-05-09Implement path_info featureAnthony Ramine
The dispatcher now accepts '...' as the leading segment of Host and the trailing segment of Path, this special atom matches any remaining path tail. When given "cowboy.bugs.dev-extend.eu", host rule ['...', <<"dev-extend">>, <<"eu">>] matches and fills host_info with [<<"cowboy">>, <<"bugs">>]. When given "/a/b/c/d", path rule [<<"a">>, <<"b">>, '...'] matches and fills path_info with [<<"c">>, <<"d">>].
2011-05-09Remove a superfluous function clause in try_matchAnthony Ramine
2011-05-08Add chunked reply support.Loïc Hoguin
Send the status line and headers using cowboy_http_req:chunked_reply/3, and individual chunks with cowboy_http_req:chunk/2.
2011-05-08Separate building the response head from replying.Loïc Hoguin
2011-05-07Removed a few lines from the README for pedantic correctness.Loïc Hoguin
2011-05-07Merge remote-tracking branch 'nox/improve-readme'Loïc Hoguin
2011-05-07Improve READMEAnthony Ramine
2011-05-07Merge remote-tracking branch 'nox/atom-response-headers'Loïc Hoguin
2011-05-07Greatly improve the README.Loïc Hoguin
Forward me any more questions and I'll continue on improving it.
2011-05-06Allow atoms for response header namesAnthony Ramine
2011-05-05Add headers_huge test, demonstrating issue #3 is fixed.Loïc Hoguin
The previous commit switching to raw recv + erlang:decode_packet/3 works around the OTP bug regarding headers size in http recv.
2011-05-05Switch the HTTP protocol to use binary packets instead of lists.Loïc Hoguin
The server now does a single recv (or more, but only if needed) which is then sent to erlang:decode_packet/3 multiple times. Since most requests are smaller than the default MTU on many platforms, we benefit from this greatly. In the case of requests with a body, the server usually read at least part of the body on the first recv. This is bufferized properly and used when later retrieving the body. In the case of pipelined requests, we can end up reading many requests in a single recv, which are then handled properly using only the buffer containing the received data.