aboutsummaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)Author
2013-01-06Add protection against slowloris vulnerabilityLoïc Hoguin
This changes the behavior of the `timeout` protocol option to mean "Time in which the full request line and headers must be received". The default of 5s should be fine for all normal uses. This change has no noticeable impact on performance and is thus enabled by default for everyone. It can be disabled by setting `timeout` to `infinity` although that is definitely not encouraged. Inspired by the contribution from @naryl on github.
2013-01-05Add cowboy_req:set_resp_body_fun/2Loïc Hoguin
This allows streaming a body without knowing the length in advance. Also allows {stream, StreamFun} response body in the REST code.
2013-01-05Fix a small warning in eunit_SUITELoïc Hoguin
2013-01-05Change the response body streaming fun interfaceLoïc Hoguin
Before we were required to get the socket and transport ourselves, now they're passed to the function.
2013-01-05Stop using rebar in the MakefileLoïc Hoguin
First and foremost: yes, you can still use Cowboy as a rebar dependency. This commit only removes the use of rebar when *developing* Cowboy, not when *using* Cowboy. Over the past two years I went from very happy with rebar to unsatisfied and most recently found it counter productive in many ways, from having insane default configuration to various unefficient operations. The earlier reversal from 'rebar ct' to 'ct_run' made my workflow much more natural, as I always needed to look at 'logs/raw.log' to find out what was wrong, anyway. Why not let 'ct_run' output it directly instead? Removing rebar made my life easier. If you wonder why I don't patch rebar, there's two reasons. First is that the direction taken by rebar isn't compatible with my views, and this would be a huge fight to steer it in another direction. I got other, more important fights to make. Second is that I'd rather patch OTP so that everyone benefits from it, not just users of rebar. Anyway this isn't my personal blog so I will stop babbling here. There's a few important things to note relative to this commit: * You don't need rebar to work on Cowboy anymore * The eunit tests are now ran through common_test Ping me if it doesn't work out for you.
2013-01-04Use ct_run instead of rebar ct for running ct testsLoïc Hoguin
Small tweak to the autobahn test file, we look for the python2 executable now. It'll make my life easier.
2013-01-04Hello 2013Loïc Hoguin
2013-01-03Add middleware supportLoïc Hoguin
Middlewares allow customizing the request processing. All existing Cowboy project are incompatible with this commit. You need to change `{dispatch, Dispatch}` in the protocol options to `{env, [{dispatch, Dispatch}]}` to fix your code.
2012-12-22Merge branch 'fix-websocket-timeout' of git://github.com/jeremyong/cowboyLoïc Hoguin
2012-12-22Cancel timer only on websocket_data receives or sendsJeremy Ong
This commit prevents erlang messages from keeping a websocket connection alive. Previously, the timer was canceled upon any activity. Now, the timeout is only canceled when actual data is sent from the client. The handler_loop_timeout/1 function is called from websocket_data/4 instead of handler_before_loop/4. It is also called after every successful reply in handler_call/4.
2012-12-22Make sure an incorrect port returns a 400 errorLoïc Hoguin
2012-12-08Add {close, StatusCode, Payload} and fix {close, Payload}Loïc Hoguin
2012-12-03Remove the dependency on httpd_utilLoïc Hoguin
Add the function cowboy_clock:rfc1123/1 that formats the given date to the RFC1123 format.
2012-12-03Allow passing the Req and an updated Opts when upgrading protocolsLoïc Hoguin
2012-12-02Add more frame types available in websocket repliesLoïc Hoguin
We can now reply empty close, ping and pong frames, or close frames with a payload. This means that we can send a frame and then close the connection in a single operation. If a close packet is sent, the connection is closed immediately, even if there was frames that remained to be sent. Cowboy will silently drop any extra frames in the list given as a reply.
2012-11-30Return a 400 error if the Accept header was incorrectLoïc Hoguin
2012-11-29Add a better error message when user callbacks are not exportedLoïc Hoguin
2012-11-27Fix a test that worked intermittentlyLoïc Hoguin
2012-10-11Allow websocket handlers to reply more than one frameLoïc Hoguin
Instead of returning {text, Data}, you can now return [{text, Data}, {text, Data2}, ...].
2012-10-11Fix the autobahn test suiteLoïc Hoguin
All tests still pass! (Excluding UTF-8 of course.)
2012-10-11Add crypto into the required applicationsLoïc Hoguin
As suggested by @prof3ta.
2012-10-04The onresponse hook now receives 4 arguments, including the bodyLoïc Hoguin
We do not always provide the body however. It is not available when using chunked replies, or when using set_resp_body_fun.
2012-09-29Add max_headers optionLoïc Hoguin
It is only enforced when Cowboy needs to wait for more data. Also fix a few types and a few status codes.
2012-09-26Optimize cowboy_protocolLoïc Hoguin
* #state{} changes are avoided where possible * #state{} is now smaller and use less memory * the Req object is created only after the whole request is parsed * parsing makes use of a single binary match context * external calls are avoided in the critical path * URL fragment is now extracted properly (retrieval API next commit) * argument orders to local functions modified to avoid extra operations * dispatching waits as long as possible before tokenizing host/path * handler opts are no longer shown in the error messages except in init The code may not look as beautiful as it was before. But it really is, for parsing code. The parsing section of the file may be skipped if your eyes start to burn.
2012-09-24Removal of binary:split from cowboy_dispatcher and small optimizationsLoïc Hoguin
The internal host_tokens value now has host tokens in reverse order compared to before. This allows us to remove one lists:reverse call.
2012-09-21Make multipart part headers binary lowercaseLoïc Hoguin
Here we do not remove decode_packet yet, we just lowercase the header name and transform it into a binary if needed, to fix the consistency issue.
2012-09-21Don't use decode_packet/3 for parsing the headersLoïc Hoguin
Header names are now binaries. Since header names are case insensitive they are all converted to lowercase. For example: <<"content-length">>. The max_line_length option was removed. Three new options have been added instead: * max_request_line_length (defaults to 4096) * max_header_name_length (defaults to 64) * max_header_value_length (defaults to 4096)
2012-09-21Don't use decode_packet/3 for parsing the request-lineLoïc Hoguin
First step in making all methods and header names binaries to get rid of many inconsistencies caused by decode_packet/3. Methods are all binary now. Note that since they are case sensitive, the usual methods become <<"GET">>, <<"POST">> and so on.
2012-09-17Improve consistency of return types for cowboy_req APILoïc Hoguin
The signature of parse_header, body_qs, multipart_data and the set_resp_* functions has changed. See the cowboy_req module edoc for more details.
2012-09-10Replace cowboy_req:path/1 with cowboy_req:raw_path/1Loïc Hoguin
The latter is much more useful than the former, which ends up being removed.
2012-08-27Rename cowboy_http_websocket to cowboy_websocketLoïc Hoguin
2012-08-27Rename cowboy_http_static to cowboy_staticLoïc Hoguin
2012-08-27Rename cowboy_http_rest to cowboy_restLoïc Hoguin
2012-08-27Rename cowboy_http_req to cowboy_reqLoïc Hoguin
2012-08-27Rename cowboy_http_protocol to cowboy_protocolLoïc Hoguin
2012-08-27Update behaviours for R15B+Loïc Hoguin
This effectively drops the R14B compatibility. The cowboy_req:req() type will be introduced in a future commit. It refers to the #http_req{} record.
2012-08-27Switch to Ranch for connection handlingLoïc Hoguin
This is the first of many API incompatible changes. You have been warned.
2012-05-23Update version to 0.6.00.6.0Loïc Hoguin
Also update the CHANGELOG and copyright years.
2012-05-21Remove a dumb warning when running the testsLoïc Hoguin
2012-05-21Merge branch 'serve-static-file' of https://github.com/klaar/cowboyLoïc Hoguin
Fix alphabetical order since @klaar seems to have issues with it. ;)
2012-05-21Fix a bug preventing 'onresponse' from being called on errorsLoïc Hoguin
2012-05-21Small updates to the ROADMAP and doc commentsLoïc Hoguin
2012-05-05Add a test checking requests with size around the MTULoïc Hoguin
2012-05-04Merge branch 'response-hook'Loïc Hoguin
2012-05-04Add an 'onresponse' hookLoïc Hoguin
This new protocol option is a fun. It expects 3 args: the Status code used in the reply (this is the cowboy_http:status() type, it can be an integer or a binary), the headers that will be sent in the reply, and the Req. It should only return a possibly modified Req. This can be used for many things like error logging or custom error pages. If a reply is sent inside the hook, then Cowboy will discard the reply initially sent. Extra caution must be used in the handlers making use of inline chunked replies as they will throw an error. This fun cannot be used as a filter, you can either observe the reply sent or discard it to send a different one instead. The hook will not be called for replies sent from inside the hook.
2012-05-02Add a test for HTTP handlers loop timeoutsLoïc Hoguin
2012-04-30Add file option to cowboy_http_staticMagnus Klaar
2012-04-29Fix and rework the HTTP test suiteLoïc Hoguin
Use a proper HTTP client to run all tests. This client is currently undocumented and should not be used. Includes a few fixes: * Fix a bug in the max_keepalive test * Fix a bug with max_keepalive handling * Fix a bug in stream_body/1 where data was lost under some conditions The tests now run quite faster than before. All the tests now run twice: once for TCP, once for SSL.
2012-04-06Merge branch 'websocket-fragments' of https://github.com/klaar/cowboyLoïc Hoguin
2012-04-06Update autobahn suite to use autobahntestsuiteMagnus Klaar