aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2012-05-04Add an 'onresponse' hookLoïc Hoguin
This new protocol option is a fun. It expects 3 args: the Status code used in the reply (this is the cowboy_http:status() type, it can be an integer or a binary), the headers that will be sent in the reply, and the Req. It should only return a possibly modified Req. This can be used for many things like error logging or custom error pages. If a reply is sent inside the hook, then Cowboy will discard the reply initially sent. Extra caution must be used in the handlers making use of inline chunked replies as they will throw an error. This fun cannot be used as a filter, you can either observe the reply sent or discard it to send a different one instead. The hook will not be called for replies sent from inside the hook.
2012-05-01Refactor the reply functionsLoïc Hoguin
2012-04-30Merge branch 'cowboy-client'Loïc Hoguin
2012-04-29Fix and rework the HTTP test suiteLoïc Hoguin
Use a proper HTTP client to run all tests. This client is currently undocumented and should not be used. Includes a few fixes: * Fix a bug in the max_keepalive test * Fix a bug with max_keepalive handling * Fix a bug in stream_body/1 where data was lost under some conditions The tests now run quite faster than before. All the tests now run twice: once for TCP, once for SSL.
2012-04-29Add .cowboy.plt to the gitignoreLoïc Hoguin
2012-04-13Add a clean-docs target to the MakefileLoïc Hoguin
2012-04-12Cleanup the .gitignoreLoïc Hoguin
2012-04-12Use a separate rebar.config file for running testsLoïc Hoguin
2012-04-06Merge branch 'adt-add-sockname' of https://github.com/Vagabond/cowboyLoïc Hoguin
2012-04-06Merge branch 'websocket-fragments' of https://github.com/klaar/cowboyLoïc Hoguin
2012-04-06Add sockname/1 to the TCP and SSL transportsAndrew Thompson
2012-04-06Update autobahn suite to use autobahntestsuiteMagnus Klaar
2012-04-05Add support for fragmented websocket messagesMagnus Klaar
2012-04-01Add chunked transfer encoding support and rework the body reading APILoïc Hoguin
Introduces 3 low level functions and updates the existing higher levels functions. The new primitives are has_body/1, body_length/1 and stream_body/1. In addition to that, a helper function init_stream/4 has been added. Streaming a body implies to decode the Transfer-Encoding and Content-Encoding used for the body. By default, Cowboy will try to figure out what was used and decode them properly. You can override this if you want to disable this behavior or simply support more encodings by calling the init_stream/4 function before you start streaming the body.
2012-04-01Merge branch 'log-proplist-req'Loïc Hoguin
2012-04-01Convert request to proplist when loggingMagnus Klaar
2012-03-23Merge branch 'add-ssl-ciphers-configuration' of ↵Loïc Hoguin
https://github.com/tillitech/cowboy
2012-03-23Update the edoc for cowboy_ssl_transport:listen/1Ali Sabil
2012-03-23Merge branch 'patch-1' of https://github.com/si14/cowboyLoïc Hoguin
2012-03-22Fixing badmatch when browser closes connection earlier than file was fully sentDmitry Groshev
2012-03-21Add support for specifying the ciphers for the SSL transportAli Sabil
2012-03-21Simplify the options filtering code in cowboy_ssl_transportAli Sabil
2012-03-15Don't close requests when the replied body is chunkedLoïc Hoguin
2012-03-15Add an 'onrequest' hook for HTTPLoïc Hoguin
This new protocol option is a fun. It expects a single arg, the Req, and should only return a possibly modified Req. This can be used for many things like URL rewriting, access logging or listener-wide authentication. If a reply is sent inside the hook, then Cowboy will consider the request handled and will move on to the next one.
2012-03-13Do not send chunked Transfer-Encoding replies for HTTP/1.0Loïc Hoguin
Fixes compatibility issue #140 reported by @majek.
2012-03-13Merge branch 'content-type-accepted-asterisk-atom' of ↵Loïc Hoguin
https://github.com/dysinger/cowboy Added a comment explaining the '*' always matching.
2012-03-12Merge branch 'fix/relax-media-type-parsing' of ↵Loïc Hoguin
https://github.com/tillitech/cowboy
2012-03-12Rename inet:ip_port() to inet:port_number()Loïc Hoguin
Thanks go to @superbobry for pointing it out.
2012-03-09Merge branch 'cookie-expire-fix' of https://github.com/klaar/cowboyLoïc Hoguin
2012-03-09Fix issue #157 relating to daylight savings time.Magnus Klaar
2012-03-09Make media type parsing more relaxedAli Sabil
Certain user agents send slightly invalid media types, like the following: "text/html, image/gif, image/jpeg, ; q=.2, */; q=.2" The user agent with which this behavior was observed presented itself with the User-Agent string: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (FlipboardProxy/0.0.5; +http://flipboard.com/browserproxy)"
2012-03-08If we have a mapping to '*' then use it as the default catch all acceptTim Dysinger
2012-03-02Merge branch 'rest-etag-fixes' of https://github.com/klaar/cowboyLoïc Hoguin
2012-02-29Tests and fixes for the generate_etag/2 callbackMagnus Klaar
The return value from the generate_etag/2 callback is expected to be a binary tagged with either weak or strong. This binary is quoted, and may be prefixed with W/ before it is set as the value of the ETag header in the response. For backwards compatibility with older handlers where the return value was expected to be a quoted binary a function has been added to parse any return values that are untagged binaries. All untagged binaries are expected to be a valid value for the ETag header.
2012-02-27Add a roadmapLoïc Hoguin
2012-02-27Remove the redundant include/ from -include("http.hrl")Loïc Hoguin
2012-02-27Remove a completed @todo commentLoïc Hoguin
2012-02-24Merge pull request #146 from ostinelli/f3de0869801d3909cc5a5d5dbee81941481a0c2eLoïc Hoguin
Polish dialyzer warnings on supervisor init/1
2012-02-24Add an empty ebin/ folder to fix a rebar/edoc issueLoïc Hoguin
When missing rebar couldn't build docs because it expects the ebin/ folder to exist before it runs edoc. This commit allows users to build docs without first having to run make.
2012-02-23Add cowboy_http:x_www_form_urlencoded/2Loïc Hoguin
This was initially an internal function, it has been made public due to popular demand as it can sometimes be needed.
2012-02-20polished dialyzer warnings on supervisor init/1 specsRoberto Ostinelli
2012-02-20Check for upgrades on accept timeoutLoïc Hoguin
Otherwise acceptors will not be upgraded properly until after the next request comes in. Thanks to DeadZen for pointing it out.
2012-02-20Merge branch 'ssl-password-cacert' of https://github.com/DeadZen/cowboyLoïc Hoguin
2012-02-20Add an examples/ directory containing a link to cowboy_examplesLoïc Hoguin
2012-02-20REST: Only send 201 when a new resource is created on POSTLoïc Hoguin
2012-02-20Add 'Expect' header parsingLoïc Hoguin
At the same time renaming cowboy_http:content_type_params/3 to cowboy_http:params/2 (with a default Acc of []) as this code isn't useful only for content types.
2012-02-08Add CA support and make SSL certificate password optionalDeadZen
2012-02-02Added absoluteURI supportDavid Kelly
If requests go through a proxy, they will have the original uri in the request, i.e. : GET http://proxy.server.uri/some/query/string HTTP 1.1 ... That was problematic -- cowboy_http_protocol:request didn't know what to to with the result of decode_packet applied to this, which would be something like: ``` erlang {http_request,'GET',{absoluteURI,http,<<"proxy.server.uri">>, undefined,<<"/some/query/string">>},{1,1}} ``` So, I just ignore the host, grab the path and pass into ``` erlang cowboy_http_protocol:request({http_request, Method, {abs_path, Path}, Version}, State) ``` Seems to do the trick without much effort.
2012-02-02Apply a trick to the erlang:hibernate calls to suppress dialyzer warningsLoïc Hoguin
Initially recommended by Magnus Klaar, the trick is to add a catch instruction before the erlang:hibernate/3 call so that Dialyzer thinks it will return, followed by the expected return value ('ok' for HTTP, 'closed' for websockets). This should be good enough until a real solution is found.
2012-02-01Fix a typo that prevented protocol options upgradesLoïc Hoguin