aboutsummaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)Author
2017-10-29Add cowboy_req:inform/2,3Loïc Hoguin
User code can now send as many 1xx responses as necessary.
2017-10-27Add cowboy_tracer_h stream handlerLoïc Hoguin
Another experimental stream handler. It enables tracing for the connection process and any children processes based on the matching of the request. It can be used to do ad-hoc tracing by sending a specific header, path, method or other. It is meant to be used both for tests and production. Some configuration scenarios are NOT safe for production, beware. It's important to understand that, at this time, tracing is enabled on the scale of the entire connection including any future request processes. Keep this in mind when trying to use it in production. The only way to stop tracing is by having the callback function exit (by calling exit/1 explicitly). This can be done after a certain number of events for example. Tracing can generate a lot of events, so it's a good idea to stop after a small number of events (between 1000 and 10000 should be good) and to avoid tracing the whole world. Documentation will follow at a later time.
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-22Add a metrics test for switching to WebsocketLoïc Hoguin
2017-10-22Ensure stream terminate is called when switching protocolsLoïc Hoguin
2017-10-21Add a test for stream_reply metricsLoïc Hoguin
2017-10-21Add a test for early_error metricsLoïc Hoguin
2017-10-21Add a metrics test when the handler didn't send anythingLoïc Hoguin
Also fix a test group to use h2 instead of HTTP/1.1.
2017-10-20Add a test for metrics with a request bodyLoïc Hoguin
2017-10-20Add experimental metrics stream handlerLoïc Hoguin
It collects metrics and passes them to a configurable callback once the stream terminates. It will be documented in a future release. More tests incoming.
2017-10-20Fix HTTP/1.1 stopping streams too earlyLoïc Hoguin
It is possible in some cases to move on to the next request without waiting, but that can be done as an optimization later on if necessary.
2017-10-03Make sure a path parsing error in the router gives a 400Loïc Hoguin
2017-10-02Fix cowboy:set_env when the env value is missingLoïc Hoguin
2017-10-02Fix infinite loop on incomplete multipart bodyJeffrey Griffin
I have amended a lot of changes from the original commit to make it behave as expected, including returning a 400 error. LH
2017-09-27Fix error response when constraint validation failsLoïc Hoguin
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-14Improve how we detect request errorsLoïc Hoguin
When the request process exits with a {request_error, Reason, Human} exit reason, Cowboy will return a 400 status code instead of 500. Cowboy may also return a more specific status code depending on the error. Currently it may also return 408 or 413. This should prove to be more solid that looking inside the stack trace.
2017-09-05Add tests for direct Req accessLoïc Hoguin
2017-09-04Accept sendfile tuple with 0 length in cowboy_reqLoïc Hoguin
This will result in no data being sent. It's simply easier to do this than to have to handle 0 size cases in user code.
2017-09-04Add a static handler test with an empty fileLoïc Hoguin
2017-09-04Alphabetical order some testsLoïc Hoguin
2017-08-14Add tests for the streams shutdown mechanismLoïc Hoguin
2017-07-14Fix the remaining http_SUITE test casesLoïc Hoguin
2017-07-13Fix more of the older testsLoïc Hoguin
The Cowboy behavior has changed a little and gives more accurate error responses now. And in some cases, successes.
2017-07-12Fix a few of the older testsLoïc Hoguin
2017-07-12Remove tests for set_resp_body with a stream funLoïc Hoguin
2017-07-12Remove any mention of the waiting_stream hackLoïc Hoguin
2017-07-12Remove the onresponse tests from http_SUITELoïc Hoguin
2017-06-28Remove outdated multipart testsLoïc Hoguin
They have equivalents in req_SUITE.
2017-06-09Make cowboy_req:read_part return multipart headers as mapLoï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-06-02Fix terminate not being called on connection close in HTTP/1.1Loïc Hoguin
Introduces the new stream_handler_SUITE test suite. More cases will be added later on.
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-05-23Fix a harmless warning in testsLoïc Hoguin
2017-05-23Add many tests for RFC7540 5.1 and 5.1.1 and related fixesLoïc Hoguin
2017-05-23Add a test suite for h2specLoïc Hoguin
h2spec must be preinstalled on the machine and its location pointed at by the H2SPEC environment variable.
2017-05-19Preliminary h2 flow control supportLoïc Hoguin
Existing tests pass. A number of things remain to be done. Has only been tested with Gun so far. Feedback welcome!
2017-05-07Add a test for cowboy:set_envLoïc Hoguin
2017-05-05Add test for inactivity_timeout option in cowboy_http2Gary Rennie
The inactivity timeout is used to close the connection in the absence of any data from the client. Since this is not part or the rfc7540 spec, a new http2_SUITE module has been created with a test for the inactivity_timeout.
2017-05-03Add the idle_timeout HTTP/1.1 protocol optionLoïc Hoguin
This fixes the connection being dropped because of request_timeout despite there being some active streams.
2017-03-02Add more HTTP/2 tests for RFC7540 4.1 and 4.3Loïc Hoguin
2017-02-26Unknown HTTP/2 frames are ignoredLoïc Hoguin
2017-02-25Add many test cases covering RFC7540 4.2Loïc Hoguin
These tests cover frame sizes. It's mostly edge cases for sure (ie misbehaving clients and us having to reject them properly). I had these almost ready for a long time, so I'm glad I can push them out. This requires updating Cowlib too (we currently track master).
2017-02-19Change the type of bindings from a list to a mapLoïc Hoguin
Maps make more sense because the keys are unique.
2017-02-19Change the order of set_resp_cookie argumentsLoïc Hoguin
The Opts value is put last, to be more consistent with the rest of the cowboy_req module. Additionally a test handler was fixed which reduced the number of errors in http_SUITE.
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-05Add test for the compress_response exampleLoïc Hoguin
2017-02-05Remove outdated todo comments from req_SUITELoïc Hoguin
2017-02-05Fix sending of large files with HTTP/2Loïc Hoguin
Also finish implementing the relevant test, getting rid of todos.