aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
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-08-12Add cowboy_req:part/2 exportMichael Truog
2014-08-06Handle absolute URIs that lack a path entirelyLoïc Hoguin
2014-08-06Accept absolute URI scheme as uppercaseLoïc Hoguin
We should be doing a case insensitive comparison to be correct, but this is more expensive. Almost all clients send lowercase, this patch fixes handling of the aws/aws-sdk-php client which sends uppercase, and no known client sends mixed case so I am holding back on the more expensive solution for the moment.
2014-08-01Update Cowboy to 1.0.01.0.0Loïc Hoguin
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-12Remove deprecated body reading interfaceLoïc Hoguin
2014-07-12Remove useless todo commentsLoïc Hoguin
2014-07-12Drop R15 supportLoïc Hoguin
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.
2014-07-07Merge branch 'fix-spdy-parse-frame' of git://github.com/voluntas/cowboyLoïc Hoguin
A fix for a possible bug has been made to the original patch.
2014-06-30Return 422 instead of 400 when AcceptResource returns falseLoïc Hoguin
422 is undefined for HTTP and interpreted as 400.
2014-06-30Update specs that were too wideLoïc Hoguin
2014-06-28Fix cowboy_spdy parse frameNakai Ryosuke
2014-06-10Update Cowboy to 0.10.00.10.0Loïc Hoguin
2014-06-10Fix specs and a weird value in cowboy_spdyLoïc Hoguin
2014-06-10Merge branch 'binary-expires' of git://github.com/NineFX/cowboyLoïc Hoguin
2014-06-10Allow users to pass a raw binary() as the expires header.Drew Varner
2014-06-03Add a return value to onresponse hook to override status/headersLoïc Hoguin
This would allow us to override them without messing up the body, and would make it usable with the static file handler for example. Experimental at this point.
2014-06-02Add request body reading optionsLoïc Hoguin
The options were added to allow developers to fix timeout issues when reading large bodies. It is also a cleaner and easier to extend interface. This commit deprecates the functions init_stream, stream_body and skip_body which are no longer needed. They will be removed in 1.0. The body function can now take an additional argument that is a list of options. The body_qs, part and part_body functions can too and simply pass this argument down to the body call. There are options for disabling the automatic continue reply, setting a maximum length to be returned (soft limit), setting the read length and read timeout, and setting the transfer and content decode functions. The return value of the body and body_qs have changed slightly. The body function now works similarly to the part_body function, in that it returns either an ok or a more tuple depending on whether there is additional data to be read. The body_qs function can return a badlength tuple if the body is too big. The default size has been increased from 16KB to 64KB. The default read length and timeout have been tweaked and vary depending on the function called. The body function will now adequately process chunked bodies, which means that the body_qs function will too. But this means that the behavior has changed slightly and your code should be tested properly when updating your code. The body and body_qs still accept a length as first argument for compatibility purpose with older code. Note that this form is deprecated and will be removed in 1.0. The part and part_body function, being new and never having been in a release yet, have this form completely removed in this commit. Again, while most code should work as-is, you should make sure that it actually does before pushing this to production.
2014-04-26Merge branch 'language-range-header' of git://github.com/NineFX/cowboyLoïc Hoguin
2014-04-26Make loop handlers work with SPDYLoïc Hoguin
Adds a loop_handler test suite that runs all tests under HTTP, HTTPS, SPDY each with and without the compress option enabled. Fixes output filtering that used to filter more than it should have. This forces us to parse the string sent by the emulator, which means it's probably not perfect yet. But it should at least not hide errors we want to see. Fix a crash in the output filtering code that entirely disabled output. Now when there is a crash the normal tty output is restored. Handlers are now in test/handlers/ as they can be reused between suites. Only generate a single certificate for the whole ct run to speed things up when we got many different test groups each needing certificates.
2014-04-17Merge branch 'fix/basic-auth-empty-password' of git://github.com/soundrop/cowboyLoïc Hoguin
2014-03-27Update cowlib to 0.6.1Loïc Hoguin
2014-03-27Add +warn_missing_spec and fix specsLoïc Hoguin
2014-03-26Remove outdated comments, all edoc, plus a few minor tweaksLoïc Hoguin
2014-03-25Make the latin1 cyrillic route tests work on R17+Loïc Hoguin
Instead of relying on the encoding of the file we now simply have list of numbers as they would be inside a latin1 file.
2014-03-25Don't flush the resp_sent message if connection is closedLoïc Hoguin
Tiny optimization.
2014-03-24Remove cowboy_client; use gun for the HTTP test suiteLoïc Hoguin
2014-03-24Use the new chunked and identity transfer decoding code from cowlibLoïc Hoguin
2014-03-24Use cow_http_hd:parse_transfer_encoding/1 where applicableLoïc Hoguin
2014-03-24Use cow_http_hd:parse_content_length/1 where applicableLoïc Hoguin
2014-03-24Use cow_http_hd:parse_connection/1 where applicableLoïc Hoguin
2014-03-10Remove cowboy_http:urldecode/1 and urlencode/1Loïc Hoguin
Use cow_qs:urldecode/1 and cow_qs:urlencode/1 instead
2014-03-08Fix typespecs of cowboy_websocket:handler_terminateLoïc Hoguin
Pointed out during the ConcuError tutorial by Kostis. Thanks! :-)
2014-02-27Keep the whitespace from multiline headersLoïc Hoguin
Before, we could have Header: the value is multiline Become "the valueis multiline". Now it will properly be "the value is multiline".
2014-02-16Fix stop_listener/1 specSina Samavati
2014-02-09Allow empty passwords when parsing Basic authorization headerAli Sabil
2014-02-06Update copyright yearsLoïc Hoguin
2014-02-06Use the INLINE_LOWERCASE macro in the request parsing codeLoïc Hoguin
Since I made it for similar code in cowlib, let's use it here too.
2014-02-06Add and document the new multipart codeLoïc Hoguin
The old undocumented API is removed entirely. While a documentation exists for the new API, it will not be considered set in stone until further testing has been performed, and a file upload example has been added. The new API should be a little more efficient than the old API, especially with smaller messages.
2014-01-24Allows language_range/2 to parse RFC5646 language codes.Drew
2013-12-28Fix typespecs for cowboy_req:binding/{2,3} and :bindings/1Loïc Hoguin
2013-12-02Merge branch 'fix/keepalive_loop_stream_recv' of ↵Loïc Hoguin
git://github.com/fishcakez/cowboy
2013-11-26Fix tohexu/1 and tohexl/1Matthias Endler
tohexu(16) or tohexl(16) will now crash, instead of evaluating to $G or $g.
2013-11-18Fix loop handler keepalive race conditionJames Fish
Previously if a loop handler received the timeout message from a previous request on the same connection the socket would be set to {active, once} incorrectly - when a socket packet was already in the message queue. This second packet would not be added to the buffer before a Handler:info/3 call if a user message was in the message queue before both socket packets.
2013-11-14Update Cowboy to 0.9.00.9.0Loïc Hoguin
2013-11-14Add documentation for cowboy_spdyLoïc Hoguin
2013-11-09Properly send 201 on PUT requests when resource didn't existLoïc Hoguin
Regardless of whether a location header has been set, as explained in the HTTP RFC.
2013-11-09Remove an unnecessary clause in cowboy_req:body/2Loïc Hoguin