aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
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.
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-23Merge the two separate receive loops in cowboy_websocketLoïc Hoguin
Also rename a bunch of functions to make the code easier to read.
2018-03-14Fix a Dialyzer warningLoïc Hoguin
2018-03-14Add case for handling infinity for idle/request_timeoutBartek Walkowicz
Currently cowboy assumes that idle_timeout or request_timeout is a number and always starts timers. Similar situation takes place in case of preface_timeout for http2. This commit adds case for handling infinity as a timeout, allowing to not start mentioned timers.
2018-03-13Handle system messages in cowboy_websocketLoïc Hoguin
2018-03-13Handle supervisor calls properly everywhereLoïc Hoguin
2018-02-28Fix crash in cowboy_http2 when content-length is invalidLoïc Hoguin
2018-01-24Fix sending HTTP/2 bodies as iolists out of orderLoïc Hoguin
2018-01-23Fix an unused variable warningLoïc Hoguin
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
2018-01-16Allow colon within path segmentsPaul Fisher
Allow `cowboy_router:compile` to handle colon characters within path segments, rather than exiting with `badarg`. This is allowed via RFC 7230 2.7 -> [RFC 3986 3.3](https://tools.ietf.org/html/rfc3986#section-3.3): ``` segment = *pchar segment-nz = 1*pchar segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" ) ; non-zero-length segment without any colon ":" pchar = unreserved / pct-encoded / sub-delims / ":" / "@" ```
2017-12-13Fix Dialyzer warningsLoïc Hoguin
2017-12-12Don't badmatch on HTTP/2 preface's Transport:sendLoïc Hoguin
Send errors produce annoying logs and we notice the connection is gone later on anyway.
2017-12-12Fix HTTP/1.1 pipeliningLoïc Hoguin
Cases where a request body was involved could sometimes fail depending on timing. Also fix all of the old http_SUITE tests.
2017-12-08Add the few remaining tests to the rfc7231 test suiteLoï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-06Send a 426 when Websocket is required and client didn't upgradeLoïc Hoguin
2017-12-06Fix 408 not sending connection: close for HTTP/1.1Loïc Hoguin
Also make sure the header is sent for all types of early_error that result in the closing of the connection.
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-12-06Also disable the TRACE method entirelyLoïc Hoguin
2017-12-06Disable the CONNECT method completelyLoïc Hoguin
It's safer than allow it with the wrong behavior.
2017-12-04Add an rfc7231 test suite, fix an HTTP/2 bug with HEADLoïc Hoguin
In some cases there could be a body sent as a response to a HEAD request when using HTTP/2. This has been corrected.
2017-11-30Fix HTTP/2 pushLoïc Hoguin
2017-11-29Don't send chunked bodies when the method is HEADLoïc Hoguin
2017-11-29Don't include a content-length in 204 responsesLoïc Hoguin
2017-11-29Reject absolute URIs with no authority componentsLoïc Hoguin
2017-11-29Reject absolute URIs with userinfo components in HTTP/1.1Loïc Hoguin
2017-11-29Reject whitespace before/after HTTP/1.1 header names properlyLoïc Hoguin
2017-11-29Don't send a GOAWAY frame on close when the h2 preface is invalidLoïc Hoguin
2017-11-29Ignore stray HTTP/2 stream messages that we expectLoïc Hoguin
2017-11-29Add many rfc7540 tests, improve detection of malformed requestsLoïc Hoguin
2017-11-27Add more flow control tests to rfc7540 and fix related issuesLoïc Hoguin
2017-11-27Add more rfc7540 tests along with their respective fixesLoïc Hoguin
2017-11-27Fix a few rfc7540 testsLoïc Hoguin
Cowboy takes a few shortcuts to avoid wasting resources when there is a protocol error. The RFC wants us to send a different error depending on the state of the stream at the time of the error, and for us to maintain the connection in cases where we would have to spend valuable resources to decode headers. In all these cases Cowboy will simply close the connection with an appropriate error.
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-20Add more rfc7230 tests and improve transfer-encodingLoïc Hoguin
It's worth noting that transfer-encoding now takes precedence over content-length as recommended by the RFC, so that when both headers are sent we only care about transfer-encoding and explicitly remove content-length from the headers.
2017-11-20Add a test for early errors that occur on the request-lineLoïc Hoguin
2017-11-20Queue HTTP/2 trailers when there's still data in the bufferLoïc Hoguin
2017-11-20Fix compression when trailers are sentLoïc Hoguin
2017-11-20Remove a useless todoLoïc Hoguin
2017-11-20Add more rfc7230 testsLoïc Hoguin
Also fixes the handling of the max_headers option for HTTP/1.1. It is now a strict limit and not dependent on whether data is already in the buffer.
2017-11-17Initialize trace patterns only onceLoïc Hoguin
They are global for the node for all future call trace flags, so it's not necessary to set them repeatedly with every request. Doing it once at startup also ensures we can't have race conditions when the user wants to change which trace patterns should be used (because requests are concurrent and patterns end up overwriting themselves repeatedly), and makes this changing of trace patterns much more straightforward: the user can just define the ones they want. The default function traces everything. In addition I have also added the tracer_flags option to make the trace flags configurable, excluding the tracer pid.
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-13Don't supervise the tracer processLoïc Hoguin
If we do then we end up killing the tracer after the stream terminates and this is not what we want. This prevents us from getting useful information from requests that are still ongoing (when they run concurrently) and completely prevents us from tracing Websocket handlers. I'm not the biggest fan of having unsupervised modules but if this is properly documented there should be no problem.
2017-11-13Fix packet being dropped when using switch_protocolLoïc Hoguin
This only happens if the switch takes too long, and should not happen unless a spawned process refuses to shut down immediately.
2017-11-10Keep the state returned by the tracer callbackLoïc Hoguin
It was mistakenly discarded.
2017-11-03Add a terminate event to the tracer and more testsLoïc Hoguin