aboutsummaryrefslogtreecommitdiffstats
path: root/test/http_SUITE.erl
AgeCommit message (Collapse)Author
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
2016-03-05Initial commit with connection/streamsLoïc Hoguin
Breaking changes with previous commit. This is a very large change, and I am giving up on making a single commit that fixes everything. More commits will follow slowly adding back features, introducing new tests and fixing the documentation. This change contains most of the work toward unifying the interface for handling both HTTP/1.1 and HTTP/2. HTTP/1.1 connections are now no longer 1 process per connection; instead by default 1 process per request is also created. This has a number of pros and cons. Because it has cons, we also allow users to use a lower-level API that acts on "streams" (requests/responses) directly at the connection process-level. If performance is a concern, one can always write a stream handler. The performance in this case will be even greater than with Cowboy 1, although all the special handlers are unavailable. When switching to Websocket, after the handler returns from init/2, Cowboy stops the stream and the Websocket protocol takes over the connection process. Websocket then calls websocket_init/2 for any additional initialization such as timers, because the process is different in init/2 and websocket_*/* functions. This however would allow us to use websocket_init/2 for sending messages on connect, instead of sending ourselves a message and be subject to races. Note that websocket_init/2 is optional. This is all a big change and while most of the tests pass, some functionality currently doesn't. SPDY is broken and will be removed soon in favor of HTTP/2. Automatic compression is currently disabled. The cowboy_req interface probably still have a few functions that need to be updated. The docs and examples do not refer the current functionality anymore. Everything will be fixed over time. Feedback is more than welcome. Open a ticket!
2015-08-07Use 'Connection' header only when necessaryAlexey Lebedeff
Fixes #839 when 'Connection: Keep-Alive' wasn't sent in a HTTP/1.0 response. Now the usage of 'Connection' header is consistent with current protocol version: when this header is not specified explicitly in the response, HTTP/1.0 implies 'Connection: close' and HTTP/1.1 implies 'Connection: Keep-Alive'. So if current 'Connection' value matches the default value of current protocol, we won't state obvious fact in the response; and vice versa. Amended to fix and improve tests, and revert the variable name change from HTTP11Headers to StdHeaders. I think it's still good to leave it as is because it's not really a standard header for HTTP/1.0, and it's gone from HTTP/2 entirely.
2015-05-05Add rfc7230 test suite and update others to recent GunLoïc Hoguin
This is a large commit. The rfc7230 test suite adds many tests from the RFC7230 document. Gun has been updated quite a bit recently, which broke the Cowboy suites. This is now fixed with this commit. A new hook onfirstrequest has been added. It was very useful during debugging of the test suites. The initial process code has changed a little; more changes are expected with the switch to maps for options.
2015-02-04Use cowlib for parsing headers; remove cowboy_httpLoïc Hoguin
2014-11-07Rename 'halt' to 'stop' for better consistencyLoïc Hoguin
Now everywhere in Cowboy when we want to stop something we return a 'stop' tuple instead of one of the many choices depending on context that we had before. This particular change affects middlewares, sub protocols and REST handlers which were using 'halt' to stop processing.
2014-10-03Fix two edge cases when the request-line provided is invalidLoïc Hoguin
2014-09-30Improve handler interface and documentationLoïc Hoguin
This change simplifies a little more the sub protocols mechanism. Aliases have been removed. The renaming of loop handlers as long polling handlers has been reverted. Plain HTTP handlers now simply do their work in the init/2 callback. There is no specific code for them. Loop handlers now follow the same return value as Websocket, they use ok to continue and shutdown to stop. Terminate reasons for all handler types have been documented. The terminate callback is now appropriately called in all cases (or should be). Behaviors for all handler types have been moved in the module that implement them. This means that cowboy_handler replaces the cowboy_http_handler behavior, and similarly cowboy_loop replaces cowboy_loop_handler, cowboy_websocket replaces cowboy_websocket_handler. Finally cowboy_rest now has the start of a behavior in it and will have the full list of optional callbacks defined once Erlang 18.0 gets released. The guide has been reorganized and should be easier to follow.
2014-09-24Remove the onrequest hookLoïc Hoguin
It was redundant with middlewares. Allows us to save a few operations for every incoming requests.
2014-09-23Breaking update of the cowboy_req interfaceLoïc Hoguin
Simplify the interface for most cowboy_req functions. They all return a single value except the four body reading functions. The reply functions now only return a Req value. Access functions do not return a Req anymore. Functions that used to cache results do not have a cache anymore. The interface for accessing query string and cookies has therefore been changed. There are now three query string functions: qs/1 provides access to the raw query string value; parse_qs/1 returns the query string as a list of key/values; match_qs/2 returns a map containing the values requested in the second argument, after applying constraints and default value. Similarly, there are two cookie functions: parse_cookies/1 and match_cookies/2. More match functions will be added in future commits. None of the functions return an error tuple anymore. It either works or crashes. Cowboy will attempt to provide an appropriate status code in the response of crashed handlers. As a result, the content decode function has its return value changed to a simple binary, and the body reading functions only return on success.
2014-07-14Support ad-hoc keep-alive for HTTP/1.0 ClientsFred Hebert
Only go for keep-alive if they submit a 'connection: keep-alive' header in the request, keep behaviour the same otherwise. The new RFC 7230 (http://tools.ietf.org/html/rfc7230#section-6.3) states: If the received protocol is HTTP/1.0, the "keep-alive" connection option is present, the recipient is not a proxy, and the recipient wishes to honor the HTTP/1.0 "keep-alive" mechanism, the connection will persist after the current response; Even though clients are discouraged from doing so in Appendix A.1.2 (http://tools.ietf.org/html/rfc7230#appendix-A.1.2)
2014-07-12Reply with 400 on header parsing crashLoïc Hoguin
This is a first step to improve the HTTP status codes returned by Cowboy on crashes. We will tweak it over time. Also fixes a small bug where two replies may have been sent when using loop handlers under rare conditions.