aboutsummaryrefslogtreecommitdiffstats
path: root/test/http_SUITE.erl
AgeCommit message (Collapse)Author
2024-01-25Refresh copyright linesLoïc Hoguin
2024-01-18Reduce sleep in chunked_one_byte_at_a_timeLoïc Hoguin
To avoid having the connection get closed due to us taking too long on unreliable environments like GitHub Actions.
2024-01-17Improve reliability of a few testsLoïc Hoguin
GitHub Actions runners are not as good as self-hosted BuildKite so some adjustments need to be made to timeouts and such.
2024-01-16Fix an intermittent test failureLoïc Hoguin
2024-01-15Fix wrong HTTP/1 timeout being used in some casesLoïc Hoguin
Added many tests to ensure the right timeout is picked in the appropriate situation. Should there be any issues remaining we can add more tests.
2023-12-21Optionally reset the idle timeout when sending dataRobert J. Macomber
A new option reset_idle_timeout_on_send has been added. When set to 'true', the idle timeout is reset not only when data is received, but also when data is sent. This allows sending large responses without having to worry about timeouts triggering. The default is currently unchanged but might change in a future release. LH: Greatly reworked the implementation so that the timeout gets reset on almost all socket writes. This essentially completely supersets the original work. Tests are mostly the same although I refactored a bit to avoid test code duplication. This commit also changes HTTP/2 behavior a little when data is received: Cowboy will not attempt to update the window before running stream handler commands to avoid sending WINDOW_UPDATE frames twice. Now it has some small heuristic to ensure they can only be sent once at most.
2023-12-18Explicitly close the socket in some tests for speed upsLoïc Hoguin
The socket staying open meant that the graceful shut down of the Cowboy listeners were waiting for the connections to be closed gracefully (or a timeout). Closing explicitly where it makes sense ensures we don't unnecessarily wait. This commit removes a full minute in the run time of all Cowboy test suites (minus examples).
2023-12-18Fix shutdown for HTTP/1.1 pipelineDmitri Vereshchagin
Sending extra response prevented by terminating all streams except the one currently executing. LH: Reworded some variables to make what happens more obvious.
2023-12-14Change send_timeout_close test to accomodate macOSLoïc Hoguin
2023-12-12Add test for send_timeout_closeSergei Shuvatov
LH: I reworked the test a little and added the same test for HTTP/2 so that both HTTP/1.1 and HTTP/2 get the issue fixed.
2020-11-27Graceful shutdownViktor Söderqvist
Note: This commit makes cowboy depend on cowlib master. Graceful shutdown for HTTP/2: 1. A GOAWAY frame with the last stream id set to 2^31-1 is sent and a timer is started (goaway_initial_timeout, default 1000ms), to wait for any in-flight requests sent by the client, and the status is set to 'closing_initiated'. If the client responds with GOAWAY and closes the connection, we're done. 2. A second GOAWAY frame is sent with the actual last stream id and the status is set to 'closing'. If no streams exist, the connection terminates. Otherwise a second timer (goaway_complete_timeout, default 3000ms) is started, to wait for the streams to complete. New streams are not accepted when status is 'closing'. 3. If all streams haven't completed after the second timeout, the connection is forcefully terminated. Graceful shutdown for HTTP/1.x: 1. If a request is currently being handled, it is waited for and the response is sent back to the client with the header "Connection: close". Then, the connection is closed. 2. If the current request handler is not finished within the time configured in transport option 'shutdown' (default 5000ms), the connection process is killed by its supervisor (ranch). Implemented for HTTP/1.x and HTTP/2 in the following scenarios: * When receiving exit signal 'shutdown' from the supervisor (e.g. when cowboy:stop_listener/3 is called). * When a connection process is requested to terminate using sys:terminate/2,3. LH: Edited tests a bit and added todos for useful tests to add.
2019-09-28Add persistent_term support to the routerLoïc Hoguin
2018-11-22Improve the reliability of some http_SUITE testsLoïc Hoguin
2018-11-21Move some tests out of the old HTTP test suiteLoïc Hoguin
And additional minor tweaks.
2018-11-20Fix the request_timeout_infinity testLoïc Hoguin
Wrong option was being tested.
2018-11-20Handle a test case sometimes sending a response too fastLoïc Hoguin
2018-11-20Wait for the connection to be up in a few testsLoïc Hoguin
2018-11-19Use try..after in tests that start their own listenersLoïc Hoguin
2018-11-19Use ?FUNCTION_NAME instead of ct_helper:name()Loïc Hoguin
Cowboy is 19+ so it's OK to use it.
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-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-14Allow disabling keep-alive for HTTP/1.0 connectionsLoïc Hoguin
2018-09-26Use gun:info instead of hacks for test socket operationsLoïc Hoguin
2018-09-23Correct two tests that introspect the Gun stateLoïc Hoguin
It has changed in Gun 1.2.
2018-08-13Fix the infinity timeout testsLoïc Hoguin
Make sure the test fails when the code is incorrect.
2018-05-17Move timeout tests from old_http_SUITE to http_SUITELoïc Hoguin
Also fix the idle_timeout test which was producing an extra crash log.
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-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-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-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-11-29Add nowarn_export_all to all test suitesLoïc Hoguin
2017-11-24Add more tests to the rfc7230 suiteLoïc Hoguin
Found more bugs! Unfortunately no fix for them in this commit.
2017-11-23Move the pipeline test to the rfc7230 suiteLoïc Hoguin
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-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-18Remove duplicate /echo/body_qs tests from the old suiteLoïc Hoguin
2017-11-17Remove duplicate static handler tests from the old suiteLoï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-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-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-01-03Rewrite the tests for header name/value limitsLoïc Hoguin
Putting them in the correct test suite, with the proper documentation etc.
2017-01-03Return status 431 if the request header field is too largeJosé Valim
This commit changes Cowboy to follow RFC6585.
2017-01-02Welcome to 2017Loïc Hoguin
2016-10-18Fix if_modified_since match of last_modifiedChristopher Adams
Correct expected return type from `no_call` to `undefined` in if_modified_since when last_modified callback is not defined. Add an http_SUITE test to catch regressions.
2016-08-11Use integer_to_binary when possibleLoïc Hoguin