aboutsummaryrefslogtreecommitdiffstats
path: root/test/ws_SUITE.erl
AgeCommit message (Collapse)Author
2018-11-12Add deflate options for Websocket compressionLoïc Hoguin
They allow the server to configure what it is willing to accept for both the negotiated configuration (takeover and window bits) and the other zlib options (level, mem_level and strategy). This can be used to reduce the memory and/or CPU footprint of the compressed data, which comes with a cost in compression ratio.
2018-09-11Swap the ws and autobahn test groups to run autobahn lastLoïc Hoguin
If there's an error it makes sense to have feedback as early as possible.
2018-04-17Add a Websocket test with 3000 connectionsLoïc Hoguin
To ensure the connections are not limited by max_connections.
2018-03-28Add max_frame_size option for websocket handlersKirill Kinduk
Option allows to limit a frame by size before decoding its payload. LH: I have added a test for when the limit is reached on a nofin fragmented frame (the last commit addressed that case but it had no test). I have fixed formatting and other, and changed the default value to infinity since it might otherwise be incompatible with existing code. I also added documentation and a bunch of other minor changes.
2017-11-29Add nowarn_export_all to all test suitesLoïc Hoguin
2017-06-07Remove NumAcceptors argument from start_clear/tlsLoïc Hoguin
They are now cowboy:start_clear/3 and cowboy:start_tls/3. The NumAcceptors argument can be specified via the num_acceptor transport option. Ranch has been updated to 1.4.0 to that effect.
2017-05-28Introduce the req_filter Websocket optionLoïc Hoguin
This option allows customizing the compacting of the Req object when using Websocket. By default it will keep most public fields excluding headers of course, since those can be large.
2017-02-18Allow passing options to sub protocolsLoïc Hoguin
Before this commit we had an issue where configuring a Websocket connection was simply not possible without doing magic, adding callbacks or extra return values. The init/2 function only allowed setting hibernate and timeout options. After this commit, when switching to a different type of handler you can either return {module, Req, State} or {module, Req, State, Opts} where Opts is any value (as far as the sub protocol interface is concerned) and is ultimately checked by the custom handlers. A large protocol like Websocket would accept only a map there, with many different options, while a small interface like loop handlers would allow passing hibernate and nothing else. For Websocket, hibernate must be set from the websocket_init/1 callback, because init/2 executes in a separate process. Sub protocols now have two callbacks: one with the Opts value, one without. The loop handler code was largely reworked and simplified. It does not need to manage a timeout or read from the socket anymore, it's the job of the protocol code. A lot of unnecessary stuff was therefore removed. Websocket compression must now be enabled from the handler options instead of per listener. This means that a project can have two separate Websocket handlers with different options. Compression is still disabled by default, and the idle_timeout value was changed from inifnity to 60000 (60 seconds), as that's safer and is also a good value for mobile devices.
2017-02-05Test Websocket protocol version 7Loïc Hoguin
A bit late but at least removes a todo.
2017-01-02Welcome to 2017Loïc Hoguin
2016-08-15Allow websocket_init/1 to reply/close/hibernateLoïc Hoguin
2016-08-15Modernize the Websocket test suiteLoïc Hoguin
2016-08-12Merge branch 'master' of https://github.com/camshaft/cowboyLoïc Hoguin
2016-08-12Fix Websocket compressionLoïc Hoguin
The option for enabling Websocket compression has been renamed. Previously it was shared with HTTP compression, now it's specific to Websocket. The new option is named 'websocket_compress'.
2016-06-27send resp_headers with websocket responsesCameron Bytheway
2016-03-05Initial commit with connection/streamsLoïc Hoguin
Breaking changes with previous commit. This is a very large change, and I am giving up on making a single commit that fixes everything. More commits will follow slowly adding back features, introducing new tests and fixing the documentation. This change contains most of the work toward unifying the interface for handling both HTTP/1.1 and HTTP/2. HTTP/1.1 connections are now no longer 1 process per connection; instead by default 1 process per request is also created. This has a number of pros and cons. Because it has cons, we also allow users to use a lower-level API that acts on "streams" (requests/responses) directly at the connection process-level. If performance is a concern, one can always write a stream handler. The performance in this case will be even greater than with Cowboy 1, although all the special handlers are unavailable. When switching to Websocket, after the handler returns from init/2, Cowboy stops the stream and the Websocket protocol takes over the connection process. Websocket then calls websocket_init/2 for any additional initialization such as timers, because the process is different in init/2 and websocket_*/* functions. This however would allow us to use websocket_init/2 for sending messages on connect, instead of sending ourselves a message and be subject to races. Note that websocket_init/2 is optional. This is all a big change and while most of the tests pass, some functionality currently doesn't. SPDY is broken and will be removed soon in favor of HTTP/2. Automatic compression is currently disabled. The cowboy_req interface probably still have a few functions that need to be updated. The docs and examples do not refer the current functionality anymore. Everything will be fixed over time. Feedback is more than welcome. Open a ticket!
2015-07-22Fix autobahn test suite report link when used in CILoïc Hoguin
2015-07-22Add autobahn test suite output to the consoleLoïc Hoguin
2015-05-05Add rfc7230 test suite and update others to recent GunLoïc Hoguin
This is a large commit. The rfc7230 test suite adds many tests from the RFC7230 document. Gun has been updated quite a bit recently, which broke the Cowboy suites. This is now fixed with this commit. A new hook onfirstrequest has been added. It was very useful during debugging of the test suites. The initial process code has changed a little; more changes are expected with the switch to maps for options.
2015-03-06Update Cowlib to 1.2.0; adds Websocket permessage-deflateLoïc Hoguin
The Websocket text frames should also be less resource intensive to validate now, with a binary concatenation avoided.
2014-09-26Unify the init and terminate callbacksLoïc Hoguin
This set of changes is the first step to simplify the writing of handlers, by removing some extraneous callbacks and making others optional. init/3 is now init/2, its first argument being removed. rest_init/2 and rest_terminate/2 have been removed. websocket_init/3 and websocket_terminate/3 have been removed. terminate/3 is now optional. It is called regardless of the type of handler, including rest and websocket. The return value of init/2 changed. It now returns {Mod, Req, Opts} with Mod being either one of the four handler type or a custom module. It can also return extra timeout and hibernate options. The signature for sub protocols has changed, they now receive these extra timeout and hibernate options. Loop handlers are now implemented in cowboy_long_polling, and will be renamed throughout the project in a future commit.
2014-04-22Move listener initialization to cowboy_testLoïc Hoguin
2014-04-22Start applications directly from the ct hookLoïc Hoguin
2014-04-20Enable Autobahn Test Suite by defaultLoïc Hoguin
Includes a variety of small changes that are a first step to improving the test system heavily.
2014-02-06Update copyright yearsLoïc Hoguin
2013-09-04Make cowlib a proper dependencyLoïc Hoguin
Start moving a few functions from Cowboy into cowlib.
2013-07-02Add failing tests for the websocket deflate supportAli Sabil
2013-06-20Add support for the webkit deflate frame extensionAli Sabil
2013-04-22Reorganize the websocket test suiteLoïc Hoguin
We now have the suite specific modules in the data folder. Compilation is performed by the Makefile instead of ct_run.
2013-03-02Run tests in parallelLoïc Hoguin
2013-03-02Use random ports for testsLoïc Hoguin
2013-01-28New routingLoïc Hoguin
Ultimately few things change, it's mostly just a nicer syntax and slightly different expectations. The name of the value `dispatch` did not change, because the previous dispatch values will now fail if the code is not updated to using `cowboy_router:compile/1`. No constraints have been implemented in this commit.
2013-01-22Do not require inets for running tests anymoreLoïc Hoguin
2013-01-14Improve websocket close handlingLoïc Hoguin
We now always send a failure reason (bad protocol, bad encoding, etc.) unless the closure was initiated by the client and it didn't send a close code. We now check that the close frames have a payload that is valid UTF-8, unless they don't have a payload at all. We now do not crash the process anymore when bad opcodes are sent, or when the opcode 0 is sent before fragmentation was initiated. Overall this makes us closer to full compliance with the RFC.
2013-01-12All frames sent from client to server MUST be maskedLoïc Hoguin
Good in theory, but implementations may vary. If something stops working after this commit we might need some tweaks to support existing clients. Please try it and give feedback.
2013-01-10Remove support for Websocket hixie76 draftLoïc Hoguin
It was only used by Safari 5.0.1 and possibly 5.1. Their market share is dropping as we speak. It was also insecure (disabled in Firefox for that reason). This will allow us to make much more efficient and cleaner code for the rest of the Websocket versions we support (drafts 7 to 17 + RFC), which are pretty much all versions seen in the wild excluding the one we're removing here.
2013-01-10Update autobahntestsuite to 0.5.2Loïc Hoguin
Also small mostly insignificant changes to tests.
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-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-08Add {close, StatusCode, Payload} and fix {close, Payload}Loïc Hoguin
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-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-11Add crypto into the required applicationsLoïc Hoguin
As suggested by @prof3ta.
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-04-05Add support for fragmented websocket messagesMagnus Klaar
2011-12-22Add ct tests for binary websocket framesLoïc Hoguin