aboutsummaryrefslogtreecommitdiffstats
path: root/test/handlers
AgeCommit message (Collapse)Author
2018-11-22Move the final old HTTP suite tests and remove itLoïc Hoguin
2018-11-21Move many old HTTP test cases to the rest_handler test suiteLoïc Hoguin
A bug was fixed in cowboy_rest where when content_types_provided returned a media type with a wildcard as first in the list, and a request comes in without an accept header, then the media_type value in the Req object would contain '*' instead of [] for the parameters.
2018-11-21Move another test from the old HTTP test suiteLoïc Hoguin
2018-11-18Add the chunked option for HTTP/1.1Loïc Hoguin
It allows disabling the chunked transfer-encoding. It can also be disabled on a per-request basis, although it will be ignored for responses that are not streamed.
2018-11-16Add the set_options Websocket commandLoïc Hoguin
It allows overriding the idle_timeout option only for now.
2018-11-16Ensure unknown options are ignored in set_options commandLoïc Hoguin
2018-11-16Allow overriding cowboy_http's idle_timeout per requestLoïc Hoguin
This allows requests that expect to run longer to do so without impacting the configuration of other requests.
2018-11-15Add the set_options stream handler commandLoïc Hoguin
The first two options to benefit from this are the cowboy_compress_h options.
2018-11-15Add a compress_buffering option to cowboy_compress_hLoïc Hoguin
Also changes the behavior to disable buffering by default, so that the default works in all cases, including server-sent events.
2018-11-14Don't send the content-length header in empty 304 responsesLoïc Hoguin
It's OK to send it when set explicitly, as it can be set to what the representation's size would have been.
2018-11-14Ignore the boundary parameter when accepting multipartLoïc Hoguin
2018-11-13Add the {deflate, boolean()} Websocket commandLoïc Hoguin
It allows to temporarily disable Websocket compression when it was negotiated. It's ignored otherwise. This can be used as fine-grained control when some frames do not compress well.
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-11-11Add ProvideRangeCallback tests using sendfileLoïc Hoguin
And fix this case when multiple ranges are requested.
2018-11-11Add automatic ranged request handling for bytes unitsLoïc Hoguin
Returning the atom auto instead of a callback informs Cowboy that it needs to handle range requests automatically. This changes the behavior so that the ProvideCallback function is called and then Cowboy splits the data on its own and sends the response without any other user involvement other than defining the ranges_provided/2 callback. This is a quick and dirty way to add range request support to resources, and will be good enough for many cases including for cowboy_static as it also works when the normal response body is a sendfile tuple.
2018-11-09Add sendfile support to cowboy_req:stream_bodyLoïc Hoguin
It is now possible to stream one or more sendfile tuples. A simple example of what can now be done would be for example to build a tar file on the fly using the sendfile syscall for sending the files, or to support Range requests with more than one range with the sendfile syscall. When using cowboy_compress_h unfortunately we have to read the file in order to send it. More options will be added at a later time to make sure users don't read too much into memory. This is a new feature however so existing code is not affected. Also rework cowboy_http's data sending to be flatter.
2018-11-07Add support for range requests (RFC7233) in cowboy_restLoïc Hoguin
This is currently undocumented but is planned to be documented in the next version.
2018-11-05Test stop against all relevant REST callbacksLoïc Hoguin
2018-11-05Test switch_handler against all relevant REST callbacksLoïc Hoguin
2018-11-04Add the rate_limited/2 REST callbackLoïc Hoguin
2018-11-02Add tests for charsets_providedLoïc Hoguin
Fix cases where the q-value is 0 and where a wildcard was sent in the accept-charset header. Also don't send a charset in the content-type of the response if the media type is not text. Thanks to Philip Witty for help figuring this out.
2018-11-02Better handle content negotiation when accept contains charsetsLoïc Hoguin
Thanks to Philip Witty for help figuring this out.
2018-10-31Add a cowboy_rest test for malformed if-*-match headersLoïc Hoguin
2018-10-31Add compress_threshold protocol optionSteve Domin
Currently the compression threshold is set to 300 and hardcoded in the codebase. There are cases where it make sense to allow this to be configured, for instance when you want to enforce all responses to be compressed regarldess of their size.
2018-10-31Handle error_response command in cowboy_metrics_hGrigory Starinkin
2018-10-31Always dialyze tests and fix some cowboy_req specsLoïc Hoguin
2018-09-21Add the {active, boolean()} Websocket commandLoïc Hoguin
This command is currently not documented. It allows disabling the reading of incoming data from the socket, and can be used as a poor man's flow control.
2018-09-12Do not send a 101 after a final response in switch_protocolLoïc Hoguin
2018-09-11Add a commands-based interface to Websocket handlersLoïc Hoguin
This feature is currently experimental. It will become the preferred way to use Websocket handlers once it becomes documented. A commands-based interface enables adding commands without having to change the interface much. It mirrors the interface of stream handlers or gen_statem. It will enable adding commands that have been needed for some time but were not implemented for fear of making the interface too complex.
2018-09-07Add cowboy_req:read_and_match_urlencoded_body/2,3Loïc Hoguin
2018-08-13Improve errors for when the ProvideCallback is missingLoïc Hoguin
2018-06-27Add test cases for cowboy_req:stream_eventsLoïc Hoguin
2018-06-25Add streaming without chunking for HTTP/1.1Eric Meadows-Jönsson
If content-length is set in the response headers we can skip chunked transfer-encoding.
2018-05-18Don't send transfer-encoding when streaming 204 responsesLoïc Hoguin
2018-03-26Fix the flushing of messages when switching to WebsocketLoïc Hoguin
We now flush messages that are specific to cowboy_http only. Stream handlers should also flush their own specific messages if necessary, although timeouts will be flushed regardless of where they originate from. Also renames the http_SUITE to old_http_SUITE to distinguish new tests from old tests. Most old tests need to be removed or converted eventually as they're legacy tests from Cowboy 1.0.
2018-03-23Add initial support for system messages in cowboy_loopLoïc Hoguin
2018-03-12Initial work on the sys_SUITELoïc Hoguin
There's already tests failing and quite some refactoring to be done to make some things easier to test or fix issues.
2018-01-23Fix a miscount of output flow control window for HTTP/2Loïc Hoguin
The miscount occurred because of a faulty iolist split function. The bug should now be corrected, a PropEr test has been added and a regression test has also been added.
2018-01-22Don't crash in delete_resp_header if no resp headers are setLoïc Hoguin
2017-12-07Add more rfc7231 tests and a new max_skip_body_length optionLoïc Hoguin
The option controls how much body we accept to skip for HTTP/1.1 connections when the user code did not consume the body fully. It defaults to 1MB.
2017-12-06Properly handle OPTIONS * requestsLoïc Hoguin
Support for these was broken during the development of Cowboy 2.0. It is now fixed and better handled than it ever was.
2017-11-29Fix many rfc7230 tests that were echoing the URILoïc Hoguin
2017-11-27Don't send the response immediately when using h2specLoïc Hoguin
In some cases we were sending a response faster than h2spec was sending us the test case data, resulting in the request being processed successfully instead of failing as expected.
2017-11-24Add more tests to the rfc7230 suiteLoïc Hoguin
Found more bugs! Unfortunately no fix for them in this commit.
2017-11-22Add more rfc7230 tests and better handle bad chunk sizesLoïc Hoguin
Bad chunk sizes used to be accepted and could result in a badly parsed body or a timeout. They are now properly rejected. Chunk extensions now have a hard limit of 129 characters. I haven't heard of anyone using them and Cowboy does not provide an interface for them, but we can always increase or make configurable if it ever becomes necessary (but I honestly doubt it). Also a test from the old http suite could be removed. Yay!
2017-11-20Queue HTTP/2 trailers when there's still data in the bufferLoïc Hoguin
2017-11-19Remove another test from the old http suiteLoïc Hoguin
2017-11-19Move tests from old http suite to rfc7230 suiteLoïc Hoguin
2017-11-15Add preliminary support for trailers in responsesLoïc Hoguin
This depends on changes in Cowlib that are only available on master.
2017-11-01Fix stream_handler_SUITE test failuresLoïc Hoguin