aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http2.erl
AgeCommit message (Collapse)Author
2018-08-13Fix cancelling undefined settings timerBing Han
when settings_timeout is infinity
2018-07-09Add missing logger spec for cowboy_http2 optsLoïc Hoguin
2018-06-28Introduce undocumented option loggerLoïc Hoguin
This commit reworks the logging that Cowboy does via error_logger to make the module that will do the actual logging configurable. The logger module interface must be the same as logger and lager: a separate function per log level with the same log levels they support. The default behavior remains to call error_logger, although some messages were downgraded to warnings instead of errors. Since error_logger only supports three different log levels, some messages may get downgraded/upgraded depending on what the original log level was to make them compatible with error_logger. The {log, Level, Format, Args} command was also added to stream handlers. Stream handlers should use this command to log messages because it allows writing a stream handler to intercept some of those messages and extract information or block them as necessary. The logger option only applies to Cowboy itself, not to the messages Ranch logs, so more work remains to be done in that area.
2018-06-27Disable warnings for erlang:get_stacktrace/0 in OTP-21+Loïc Hoguin
2018-05-16Honor the SETTINGS_ENABLE_PUSH from clientsLoïc Hoguin
This fixes curl when fetching resources that use push.
2018-05-16Use default port when not given in :authorityLoïc Hoguin
2018-05-07Move cowboy_iolists to Cowlib as cow_iolistsLoïc Hoguin
Depend on Cowlib master for the moment.
2018-04-30Remove a bunch of todos2.4.0Loïc Hoguin
2018-04-30Reject HTTP/2 requests with a body size different than content-lengthLoïc Hoguin
2018-04-29Receive and ignore HTTP/2 request trailers if anyLoïc Hoguin
This is a first step toward properly supporting request trailers.
2018-04-28Add SETTINGS ack timeout and option settings_timeoutLoïc Hoguin
2018-04-27Reject WINDOW_UPDATE frames sent after an RST_STREAMLoïc Hoguin
2018-04-27Add options controlling maximum h2 frame sizesLoïc Hoguin
2018-04-26Add options controlling initial control flow windowsLoïc Hoguin
2018-04-25Add the max_concurrent_streams h2 optionLoïc Hoguin
2018-04-25Add options to control h2's SETTINGS_HEADER_TABLE_SIZELoïc Hoguin
2018-04-23HTTP/2 informational responses don't end the streamLoïc Hoguin
2018-04-23Add missing enable_connect_protocol in typespecsLoïc Hoguin
2018-04-04Add initial implementation of Websocket over HTTP/2Loïc Hoguin
Using the current draft: https://tools.ietf.org/html/draft-ietf-httpbis-h2-websockets-01
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
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-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 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-20Queue HTTP/2 trailers when there's still data in the bufferLoï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 two edge cases for cowboy_req:stream_bodyLoïc Hoguin
Sending data of size 0 with the fin flag set resulted in nothing being sent to the client and still considering the response to be finished for HTTP/1.1. For both HTTP/1.1 and HTTP/2, the final chunk of body that is sent automatically by Cowboy at the end of a response that the user did not properly terminate was not passing through stream handlers. This resulted in issues like compression being incorrect. Some tests still fail under 20.1.3. They are due to recent zlib changes and should be fixed in a future patch release. Unfortunately it does not seem to be any 20.1 version that is safe to use for Cowboy, although some will work better than others.
2017-10-31Add some todosLoïc Hoguin
2017-10-29Add cowboy_req:inform/2,3Loïc Hoguin
User code can now send as many 1xx responses as necessary.
2017-10-25Introduce cowboy_req:sock/1 and cowboy_req:cert/1Loïc Hoguin
To obtain the local socket ip/port and the client TLS certificate, respectively.
2017-10-23Fix a bug in HTTP/2 where connection gets closed prematurelyLoïc Hoguin
When the user code was sending a response fully without reading the request body, the connection could get closed when receiving DATA frames for that body. We now ask the client to stop sending data via a NO_ERROR RST_STREAM, and linger any stream that has been reset so that we can skip any pending frames from that stream. This fixes a number of intermittent failures in req_SUITE, which now passes reliably. In addition a small number of rfc7540_SUITE test cases have been corrected as they were incorrect.
2017-10-21Fix stream handler state being discarded on terminateLoïc Hoguin
When we have to send a response before terminating a stream, we call info. The state returned by this info call was discarded when we called terminate after that. This commit fixes it. There are no tests for this, however the new metrics test in the next commit requires the correct behavior so this is ultimately covered.
2017-09-27Ensure the behavior on stream handler crash is consistentLoïc Hoguin
Also corrects the lack of error response when HTTP/1.1 is used.
2017-09-25Cleanup various commentsLoïc Hoguin
2017-09-25Avoid some crashes when HTTP/2 streams flush their responseLoïc Hoguin
2017-09-25Move body length count to cowboy_stream_h instead of protocolsLoïc Hoguin
The documentation was correct, the code was not. This should make it easier to implement new protocols. Note that for HTTP/2 we will need to add some form of counting later on to check for malformed requests, but we can do simpler and just reduce from the expected length and then check if that's 0 when IsFin=fin.
2017-09-21Centralize stream handler error reporting in cowboy_streamLoïc Hoguin
2017-08-21Tentative fix for out of order queued dataLoïc Hoguin
2017-08-08Implement the shutdown timeout for request processesLoïc Hoguin
This should work very similar to normal supervisors, in particular during the shutdown sequence when the connection process goes down or switches to Websocket. Processes that need to enforce the shutdown timeout will be required to trap exits, just like in a supervisor. In a vanilla Cowboy, this only matters at connection shutdown, as Cowboy will otherwise wait for the request process to be down before stopping the stream. Tests are currently missing.