From 8459bebceb9533948193774371cbd9fd571b78ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 16 Oct 2019 09:48:31 +0200 Subject: Cowboy 2.7.0 --- docs/en/cowboy/2.5/guide/constraints/index.html | 12 ++-- docs/en/cowboy/2.5/guide/cookies/index.html | 22 +++---- docs/en/cowboy/2.5/guide/erlang_web/index.html | 2 + docs/en/cowboy/2.5/guide/flow_diagram/index.html | 2 + .../en/cowboy/2.5/guide/getting_started/index.html | 18 +++--- docs/en/cowboy/2.5/guide/handlers/index.html | 10 ++-- docs/en/cowboy/2.5/guide/index.html | 2 + docs/en/cowboy/2.5/guide/introduction/index.html | 2 + docs/en/cowboy/2.5/guide/listeners/index.html | 6 +- docs/en/cowboy/2.5/guide/loop_handlers/index.html | 10 ++-- docs/en/cowboy/2.5/guide/middlewares/index.html | 2 + .../cowboy/2.5/guide/migrating_from_1.0/index.html | 2 + .../cowboy/2.5/guide/migrating_from_2.0/index.html | 2 + .../cowboy/2.5/guide/migrating_from_2.1/index.html | 2 + .../cowboy/2.5/guide/migrating_from_2.2/index.html | 2 + .../cowboy/2.5/guide/migrating_from_2.3/index.html | 2 + .../cowboy/2.5/guide/migrating_from_2.4/index.html | 2 + docs/en/cowboy/2.5/guide/modern_web/index.html | 2 + docs/en/cowboy/2.5/guide/multipart/index.html | 14 +++-- docs/en/cowboy/2.5/guide/req/index.html | 60 ++++++++++--------- docs/en/cowboy/2.5/guide/req_body/index.html | 18 +++--- .../en/cowboy/2.5/guide/resource_design/index.html | 2 + docs/en/cowboy/2.5/guide/resp/index.html | 38 ++++++------ .../en/cowboy/2.5/guide/rest_flowcharts/index.html | 2 + docs/en/cowboy/2.5/guide/rest_handlers/index.html | 4 +- .../en/cowboy/2.5/guide/rest_principles/index.html | 2 + docs/en/cowboy/2.5/guide/routing/index.html | 40 +++++++------ docs/en/cowboy/2.5/guide/specs/index.html | 2 + docs/en/cowboy/2.5/guide/static_files/index.html | 22 +++---- docs/en/cowboy/2.5/guide/streams/index.html | 2 + docs/en/cowboy/2.5/guide/ws_handlers/index.html | 30 +++++----- docs/en/cowboy/2.5/guide/ws_protocol/index.html | 2 + .../en/cowboy/2.5/manual/cowboy.set_env/index.html | 6 +- .../2.5/manual/cowboy.start_clear/index.html | 8 ++- .../cowboy/2.5/manual/cowboy.start_tls/index.html | 8 ++- .../2.5/manual/cowboy.stop_listener/index.html | 6 +- docs/en/cowboy/2.5/manual/cowboy/index.html | 12 ++-- docs/en/cowboy/2.5/manual/cowboy_app/index.html | 4 +- .../2.5/manual/cowboy_constraints.int/index.html | 8 ++- .../manual/cowboy_constraints.nonempty/index.html | 8 ++- .../2.5/manual/cowboy_constraints/index.html | 6 +- .../2.5/manual/cowboy_handler.terminate/index.html | 6 +- .../en/cowboy/2.5/manual/cowboy_handler/index.html | 4 +- docs/en/cowboy/2.5/manual/cowboy_http/index.html | 4 +- docs/en/cowboy/2.5/manual/cowboy_http2/index.html | 4 +- docs/en/cowboy/2.5/manual/cowboy_loop/index.html | 4 +- .../cowboy/2.5/manual/cowboy_middleware/index.html | 6 +- .../2.5/manual/cowboy_req.binding/index.html | 8 ++- .../2.5/manual/cowboy_req.bindings/index.html | 6 +- .../2.5/manual/cowboy_req.body_length/index.html | 6 +- .../cowboy/2.5/manual/cowboy_req.cert/index.html | 10 ++-- .../cowboy_req.delete_resp_header/index.html | 6 +- .../2.5/manual/cowboy_req.has_body/index.html | 6 +- .../2.5/manual/cowboy_req.has_resp_body/index.html | 6 +- .../manual/cowboy_req.has_resp_header/index.html | 6 +- .../cowboy/2.5/manual/cowboy_req.header/index.html | 10 ++-- .../2.5/manual/cowboy_req.headers/index.html | 8 ++- .../cowboy/2.5/manual/cowboy_req.host/index.html | 8 ++- .../2.5/manual/cowboy_req.host_info/index.html | 6 +- .../cowboy/2.5/manual/cowboy_req.inform/index.html | 8 ++- .../2.5/manual/cowboy_req.match_cookies/index.html | 10 ++-- .../2.5/manual/cowboy_req.match_qs/index.html | 10 ++-- .../cowboy/2.5/manual/cowboy_req.method/index.html | 10 ++-- .../2.5/manual/cowboy_req.parse_cookies/index.html | 6 +- .../2.5/manual/cowboy_req.parse_header/index.html | 36 ++++++------ .../2.5/manual/cowboy_req.parse_qs/index.html | 6 +- .../cowboy/2.5/manual/cowboy_req.path/index.html | 8 ++- .../2.5/manual/cowboy_req.path_info/index.html | 6 +- .../cowboy/2.5/manual/cowboy_req.peer/index.html | 8 ++- .../cowboy/2.5/manual/cowboy_req.port/index.html | 8 ++- .../cowboy/2.5/manual/cowboy_req.push/index.html | 8 ++- docs/en/cowboy/2.5/manual/cowboy_req.qs/index.html | 8 ++- .../index.html | 12 ++-- .../2.5/manual/cowboy_req.read_body/index.html | 8 ++- .../2.5/manual/cowboy_req.read_part/index.html | 10 ++-- .../manual/cowboy_req.read_part_body/index.html | 8 ++- .../cowboy_req.read_urlencoded_body/index.html | 8 ++- .../cowboy/2.5/manual/cowboy_req.reply/index.html | 10 ++-- .../2.5/manual/cowboy_req.resp_header/index.html | 8 ++- .../2.5/manual/cowboy_req.resp_headers/index.html | 6 +- .../cowboy/2.5/manual/cowboy_req.scheme/index.html | 8 ++- .../2.5/manual/cowboy_req.set_resp_body/index.html | 12 ++-- .../manual/cowboy_req.set_resp_cookie/index.html | 16 ++--- .../manual/cowboy_req.set_resp_header/index.html | 8 ++- .../manual/cowboy_req.set_resp_headers/index.html | 6 +- .../cowboy/2.5/manual/cowboy_req.sock/index.html | 8 ++- .../2.5/manual/cowboy_req.stream_body/index.html | 6 +- .../2.5/manual/cowboy_req.stream_events/index.html | 6 +- .../2.5/manual/cowboy_req.stream_reply/index.html | 8 ++- .../manual/cowboy_req.stream_trailers/index.html | 6 +- .../en/cowboy/2.5/manual/cowboy_req.uri/index.html | 16 ++--- .../2.5/manual/cowboy_req.version/index.html | 8 ++- docs/en/cowboy/2.5/manual/cowboy_req/index.html | 14 +++-- docs/en/cowboy/2.5/manual/cowboy_rest/index.html | 68 +++++++++++----------- .../2.5/manual/cowboy_router.compile/index.html | 6 +- docs/en/cowboy/2.5/manual/cowboy_router/index.html | 8 ++- docs/en/cowboy/2.5/manual/cowboy_static/index.html | 12 ++-- docs/en/cowboy/2.5/manual/cowboy_stream/index.html | 42 ++++++------- .../cowboy/2.5/manual/cowboy_websocket/index.html | 10 ++-- .../cowboy/2.5/manual/http_status_codes/index.html | 2 + docs/en/cowboy/2.5/manual/index.html | 4 +- 101 files changed, 599 insertions(+), 397 deletions(-) (limited to 'docs/en/cowboy/2.5') diff --git a/docs/en/cowboy/2.5/guide/constraints/index.html b/docs/en/cowboy/2.5/guide/constraints/index.html index bb5529bb..563f6528 100644 --- a/docs/en/cowboy/2.5/guide/constraints/index.html +++ b/docs/en/cowboy/2.5/guide/constraints/index.html @@ -71,7 +71,7 @@

Constraints for each field are provided as an ordered list of atoms or funs to apply. Built-in constraints are provided as atoms, while custom constraints are provided as funs.

When multiple constraints are provided, they are applied in the order given. If the value has been modified by a constraint then the next one receives the new value.

For example, the following constraints will first validate and convert the field my_value to an integer, and then check that the integer is positive:

-
@@ -85,7 +85,7 @@ http://www.gnu.org/software/src-highlite -->

We ignore the first fun argument in this snippet. We shouldn't. We will simply learn what it is later in this chapter.

When there's only one constraint, it can be provided directly without wrapping it into a list:

-
@@ -107,7 +107,7 @@ http://www.gnu.org/software/src-highlite -->

Custom constraints

Custom constraints are specified as a fun. This fun takes two arguments. The first argument indicates the operation to be performed, and the second is the value. What the value is and what must be returned depends on the operation.

Cowboy currently defines three operations. The operation used for validating and converting user input is the forward operation.

-
@@ -120,7 +120,7 @@ http://www.gnu.org/software/src-highlite -->

The value must be returned even if it is not converted by the constraint.

The reverse operation does the opposite: it takes a converted value and changes it back to what the user input would have been.

-
@@ -132,7 +132,7 @@ http://www.gnu.org/software/src-highlite --> end;

Finally, the format_error operation takes an error returned by any other operation and returns a formatted human-readable error message.

-
@@ -198,6 +198,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/cookies/index.html b/docs/en/cowboy/2.5/guide/cookies/index.html index bfa5ca7e..1809812f 100644 --- a/docs/en/cowboy/2.5/guide/cookies/index.html +++ b/docs/en/cowboy/2.5/guide/cookies/index.html @@ -71,7 +71,7 @@

    Cookies may be sent repeatedly. This is often useful to update the expiration time and avoid losing a cookie.

    Setting cookies

    By default cookies are defined for the duration of the session:

    -
    @@ -79,7 +79,7 @@ http://www.gnu.org/software/src-highlite --> Req = cowboy_req:set_resp_cookie(<<"sessionid">>, SessionID, Req0).

    They can also be set for a duration in seconds:

    -
    @@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite --> #{max_age => 3600}).

    To delete cookies, set max_age to 0:

    -
    @@ -97,7 +97,7 @@ http://www.gnu.org/software/src-highlite --> #{max_age => 0}).

    To restrict cookies to a specific domain and path, the options of the same name can be used:

    -
    @@ -106,7 +106,7 @@ http://www.gnu.org/software/src-highlite -->

    Cookies will be sent with requests to this domain and all its subdomains, and to resources on this path or deeper in the path hierarchy.

    To restrict cookies to secure channels (typically resources available over HTTPS):

    -
    @@ -115,7 +115,7 @@ http://www.gnu.org/software/src-highlite --> #{secure => true}).

    To prevent client-side scripts from accessing a cookie:

    -
    @@ -128,7 +128,7 @@ http://www.gnu.org/software/src-highlite -->

    The client only ever sends back the cookie name and value. All other options that can be set are never sent back.

    Cowboy provides two functions for reading cookies. Both involve parsing the cookie header(s) and so should not be called repeatedly.

    You can get all cookies as a key/value list:

    -
    @@ -136,14 +136,14 @@ http://www.gnu.org/software/src-highlite --> {_, Lang} = lists:keyfind(<<"lang">>, 1, Cookies).

    Or you can perform a match against cookies and retrieve only the ones you need, while at the same time doing any required post processing using constraints. This function returns a map:

    -
    #{id := ID, lang := Lang} = cowboy_req:match_cookies([id, lang], Req).

    You can use constraints to validate the values while matching them. The following snippet will crash if the id cookie is not an integer number or if the lang cookie is empty. Additionally the id cookie value will be converted to an integer term:

    -
    @@ -151,7 +151,7 @@ http://www.gnu.org/software/src-highlite -->

    Note that if two cookies share the same name, then the map value will be a list of the two cookie values.

    A default value can be provided. The default will be used if the lang cookie is not found. It will not be used if the cookie is found but has an empty value:

    -
    @@ -215,6 +215,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/erlang_web/index.html b/docs/en/cowboy/2.5/guide/erlang_web/index.html index 7609e315..1f9c9c76 100644 --- a/docs/en/cowboy/2.5/guide/erlang_web/index.html +++ b/docs/en/cowboy/2.5/guide/erlang_web/index.html @@ -164,6 +164,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/flow_diagram/index.html b/docs/en/cowboy/2.5/guide/flow_diagram/index.html index 69e21358..2149900d 100644 --- a/docs/en/cowboy/2.5/guide/flow_diagram/index.html +++ b/docs/en/cowboy/2.5/guide/flow_diagram/index.html @@ -142,6 +142,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/getting_started/index.html b/docs/en/cowboy/2.5/guide/getting_started/index.html index 95c87744..8d32e7c6 100644 --- a/docs/en/cowboy/2.5/guide/getting_started/index.html +++ b/docs/en/cowboy/2.5/guide/getting_started/index.html @@ -68,7 +68,7 @@

    We are going to use the Erlang.mk build system. If you are using Windows, please check the Installation instructions to get your environment setup before you continue.

    Bootstrap

    First, let's create the directory for our application.

    -
    @@ -76,21 +76,21 @@ http://www.gnu.org/software/src-highlite --> $ cd hello_erlang

    Then we need to download Erlang.mk. Either use the following command or download it manually.

    -
    $ wget https://erlang.mk/erlang.mk

    We can now bootstrap our application. Since we are going to generate a release, we will also bootstrap it at the same time.

    -
    $ make -f erlang.mk bootstrap bootstrap-rel

    This creates a Makefile, a base application, and the release files necessary for creating the release. We can already build and start this release.

    -
    @@ -102,7 +102,7 @@ http://www.gnu.org/software/src-highlite -->

    The release currently does nothing. In the rest of this chapter we will add Cowboy as a dependency and write a simple "Hello world!" handler.

    Cowboy setup

    We will modify the Makefile to tell the build system it needs to fetch and compile Cowboy:

    -
    @@ -120,7 +120,7 @@ include erlang.mk

    Listening for connections

    First we define the routes that Cowboy will use to map requests to handler modules, and then we start the listener. This is best done at application startup.

    Open the src/hello_erlang_app.erl file and add the necessary code to the start/2 function to make it look like this:

    -
    @@ -139,14 +139,14 @@ http://www.gnu.org/software/src-highlite -->

    Handling requests

    Cowboy features different kinds of handlers, including REST and Websocket handlers. For this tutorial we will use a plain HTTP handler.

    Generate a handler from a template:

    -
    $ make new t=cowboy.http n=hello_handler

    Then, open the src/hello_handler.erl file and modify the init/2 function like this to send a reply.

    -
    @@ -216,6 +216,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/handlers/index.html b/docs/en/cowboy/2.5/guide/handlers/index.html index d97992b1..0ac0d42c 100644 --- a/docs/en/cowboy/2.5/guide/handlers/index.html +++ b/docs/en/cowboy/2.5/guide/handlers/index.html @@ -67,7 +67,7 @@

    The most basic handler in Cowboy implements the mandatory init/2 callback, manipulates the request, optionally sends a response and then returns.

    This callback receives the Req object and the initial state defined in the router configuration.

    A handler that does nothing would look like this:

    -
    @@ -76,7 +76,7 @@ http://www.gnu.org/software/src-highlite -->

    Despite sending no reply, a 204 No Content response will be sent to the client, as Cowboy makes sure that a response is sent for every request.

    We need to use the Req object to reply.

    -
    @@ -93,7 +93,7 @@ http://www.gnu.org/software/src-highlite -->

    The init/2 callback can also be used to inform Cowboy that this is a different kind of handler and that Cowboy should switch to it. To do this you simply need to return the module name of the handler type you want to switch to.

    Cowboy comes with three handler types you can switch to: cowboy_rest, cowboy_websocket and cowboy_loop. In addition to those you can define your own handler types.

    Switching is simple. Instead of returning ok, you simply return the name of the handler type you want to use. The following snippet switches to a Websocket handler:

    -
    @@ -102,7 +102,7 @@ http://www.gnu.org/software/src-highlite -->

    Cleaning up

    All handler types provide the optional terminate/3 callback.

    -
    @@ -169,6 +169,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/index.html b/docs/en/cowboy/2.5/guide/index.html index 280814a9..2625d162 100644 --- a/docs/en/cowboy/2.5/guide/index.html +++ b/docs/en/cowboy/2.5/guide/index.html @@ -179,6 +179,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/introduction/index.html b/docs/en/cowboy/2.5/guide/introduction/index.html index 3c2318c8..9616ad3c 100644 --- a/docs/en/cowboy/2.5/guide/introduction/index.html +++ b/docs/en/cowboy/2.5/guide/introduction/index.html @@ -152,6 +152,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/listeners/index.html b/docs/en/cowboy/2.5/guide/listeners/index.html index 2c2f58e9..d6e3a227 100644 --- a/docs/en/cowboy/2.5/guide/listeners/index.html +++ b/docs/en/cowboy/2.5/guide/listeners/index.html @@ -68,7 +68,7 @@

    Clear TCP listener

    The clear TCP listener will accept connections on the given port. A typical HTTP server would listen on port 80. Port 80 requires special permissions on most platforms however so a common alternative is port 8080.

    The following snippet starts listening for connections on port 8080:

    -
    @@ -90,7 +90,7 @@ http://www.gnu.org/software/src-highlite -->

    The secure TLS listener will accept connections on the given port. A typical HTTPS server would listen on port 443. Port 443 requires special permissions on most platforms however so a common alternative is port 8443.

    The function provided by Cowboy will ensure that the TLS options given are following the HTTP/2 RFC with regards to security. For example some TLS extensions or ciphers may be disabled. This also applies to HTTP/1.1 connections on this listener. If this is not desirable, Ranch can be used directly to setup a custom listener.

    -
    @@ -173,6 +173,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/loop_handlers/index.html b/docs/en/cowboy/2.5/guide/loop_handlers/index.html index a0e3af72..581e960a 100644 --- a/docs/en/cowboy/2.5/guide/loop_handlers/index.html +++ b/docs/en/cowboy/2.5/guide/loop_handlers/index.html @@ -70,7 +70,7 @@

    Initialization

    The init/2 function must return a cowboy_loop tuple to enable loop handler behavior. This tuple may optionally contain the atom hibernate to make the process enter hibernation until a message is received.

    This snippet enables the loop handler:

    -
    @@ -78,7 +78,7 @@ http://www.gnu.org/software/src-highlite --> {cowboy_loop, Req, State}.

    This also makes the process hibernate:

    -
    @@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite -->

    Receive loop

    Once initialized, Cowboy will wait for messages to arrive in the process' mailbox. When a message arrives, Cowboy calls the info/3 function with the message, the Req object and the handler's state.

    The following snippet sends a reply when it receives a reply message from another process, or waits for another message otherwise.

    -
    @@ -106,7 +106,7 @@ http://www.gnu.org/software/src-highlite -->

    Streaming loop

    Another common case well suited for loop handlers is streaming data received in the form of Erlang messages. This can be done by initiating a chunked reply in the init/2 callback and then using cowboy_req:chunk/2 every time a message is received.

    The following snippet does exactly that. As you can see a chunk is sent every time an event message is received, and the loop is stopped by sending an eof message.

    -
    @@ -183,6 +183,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/middlewares/index.html b/docs/en/cowboy/2.5/guide/middlewares/index.html index c10bb445..497bdf2a 100644 --- a/docs/en/cowboy/2.5/guide/middlewares/index.html +++ b/docs/en/cowboy/2.5/guide/middlewares/index.html @@ -150,6 +150,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/migrating_from_1.0/index.html b/docs/en/cowboy/2.5/guide/migrating_from_1.0/index.html index e14928f1..8e5bd014 100644 --- a/docs/en/cowboy/2.5/guide/migrating_from_1.0/index.html +++ b/docs/en/cowboy/2.5/guide/migrating_from_1.0/index.html @@ -232,6 +232,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/migrating_from_2.0/index.html b/docs/en/cowboy/2.5/guide/migrating_from_2.0/index.html index 30b67a34..32c742d6 100644 --- a/docs/en/cowboy/2.5/guide/migrating_from_2.0/index.html +++ b/docs/en/cowboy/2.5/guide/migrating_from_2.0/index.html @@ -167,6 +167,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/migrating_from_2.1/index.html b/docs/en/cowboy/2.5/guide/migrating_from_2.1/index.html index 8ba99e4c..333824fb 100644 --- a/docs/en/cowboy/2.5/guide/migrating_from_2.1/index.html +++ b/docs/en/cowboy/2.5/guide/migrating_from_2.1/index.html @@ -178,6 +178,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/migrating_from_2.2/index.html b/docs/en/cowboy/2.5/guide/migrating_from_2.2/index.html index f6635c45..fe4f155f 100644 --- a/docs/en/cowboy/2.5/guide/migrating_from_2.2/index.html +++ b/docs/en/cowboy/2.5/guide/migrating_from_2.2/index.html @@ -150,6 +150,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/migrating_from_2.3/index.html b/docs/en/cowboy/2.5/guide/migrating_from_2.3/index.html index bba1d914..d6cc39f6 100644 --- a/docs/en/cowboy/2.5/guide/migrating_from_2.3/index.html +++ b/docs/en/cowboy/2.5/guide/migrating_from_2.3/index.html @@ -152,6 +152,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/migrating_from_2.4/index.html b/docs/en/cowboy/2.5/guide/migrating_from_2.4/index.html index a2834ba3..b40e91ff 100644 --- a/docs/en/cowboy/2.5/guide/migrating_from_2.4/index.html +++ b/docs/en/cowboy/2.5/guide/migrating_from_2.4/index.html @@ -180,6 +180,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/modern_web/index.html b/docs/en/cowboy/2.5/guide/modern_web/index.html index d88b80fb..b98aaf7b 100644 --- a/docs/en/cowboy/2.5/guide/modern_web/index.html +++ b/docs/en/cowboy/2.5/guide/modern_web/index.html @@ -146,6 +146,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/multipart/index.html b/docs/en/cowboy/2.5/guide/multipart/index.html index 9ccafec3..52e44000 100644 --- a/docs/en/cowboy/2.5/guide/multipart/index.html +++ b/docs/en/cowboy/2.5/guide/multipart/index.html @@ -73,7 +73,7 @@

    The browser does its best to determine the media type of the files it sends this way, but you should not rely on it for determining the contents of the file. Proper investigation of the contents is recommended.

    Checking for multipart messages

    The content-type header indicates the presence of a multipart message:

    -
    @@ -85,7 +85,7 @@ http://www.gnu.org/software/src-highlite -->

    The cowboy_req:read_part/1,2 functions return the next part's headers, if any.

    The cowboy_req:read_part_body/1,2 functions return the current part's body. For large bodies you may need to call the function multiple times.

    To read a multipart message you need to iterate over all its parts:

    -
    @@ -101,7 +101,7 @@ http://www.gnu.org/software/src-highlite -->

    When part bodies are too large, Cowboy will return a more tuple, and allow you to loop until the part body has been fully read.

    The function cow_multipart:form_data/1 can be used to quickly obtain information about a part from a multipart/form-data message. The function returns a data or a file tuple depending on whether this is a normal field or a file being uploaded.

    The following snippet will use this function and use different strategies depending on whether the part is a file:

    -
    @@ -130,14 +130,14 @@ http://www.gnu.org/software/src-highlite -->

    Both the part header and body reading functions can take options that will be given to the request body reading functions. By default, cowboy_req:read_part/1 reads up to 64KB for up to 5 seconds. cowboy_req:read_part_body/1 has the same defaults as cowboy_req:read_body/1.

    To change the defaults for part headers:

    -
    cowboy_req:read_part(Req, #{length => 128000}).

    And for part bodies:

    -
    @@ -146,7 +146,7 @@ http://www.gnu.org/software/src-highlite -->

    Skipping unwanted parts

    Part bodies do not have to be read. Cowboy will automatically skip it when you request the next part's body.

    The following snippet reads all part headers and skips all bodies:

    -
    @@ -219,6 +219,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/req/index.html b/docs/en/cowboy/2.5/guide/req/index.html index bfa6156e..3db834c5 100644 --- a/docs/en/cowboy/2.5/guide/req/index.html +++ b/docs/en/cowboy/2.5/guide/req/index.html @@ -69,7 +69,7 @@

    The Req map contains a number of fields which are documented and can be accessed directly. They are the fields that have a direct mapping to HTTP: the request method; the HTTP version used; the effective URI components scheme, host, port, path and qs; the request headers; the connection peer address and port; and the TLS certificate cert when applicable.

    Note that the version field can be used to determine whether a connection is using HTTP/2.

    To access a field, you can simply match in the function head. The following example sends a simple "Hello world!" response when the method is GET, and a 405 error otherwise.

    -
    @@ -95,14 +95,14 @@ http://www.gnu.org/software/src-highlite -->

    All functions will crash if something goes wrong. There is usually no need to catch these errors, Cowboy will send the appropriate 4xx or 5xx response depending on where the crash occurred.

    Request method

    The request method can be retrieved directly:

    -
    #{method := Method} = Req.

    Or using a function:

    -
    @@ -114,14 +114,14 @@ http://www.gnu.org/software/src-highlite -->

    There is typically no need to change behavior based on the HTTP version: Cowboy already does it for you.

    It can be useful in some cases, though. For example, one may want to redirect HTTP/1.1 clients to use Websocket, while HTTP/2 clients keep using HTTP/2.

    The HTTP version can be retrieved directly:

    -
    #{version := Version} = Req.

    Or using a function:

    -
    @@ -130,7 +130,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy defines the 'HTTP/1.0', 'HTTP/1.1' and 'HTTP/2' versions. Custom protocols can define their own values as atoms.

    Effective request URI

    The scheme, host, port, path and query string components of the effective request URI can all be retrieved directly:

    -
    @@ -143,7 +143,7 @@ http://www.gnu.org/software/src-highlite --> } = Req.

    Or using the related functions:

    -
    @@ -157,7 +157,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy defines only the <<"http">> and <<"https">> schemes. They are chosen so that the scheme will only be <<"https">> for requests on secure HTTP/1.1 or HTTP/2 connections.

    The effective request URI itself can be reconstructed with the cowboy_req:uri/1,2 function. By default, an absolute URI is returned:

    -
    @@ -165,7 +165,7 @@ http://www.gnu.org/software/src-highlite --> URI = cowboy_req:uri(Req).

    Options are available to either disable or replace some or all of the components. Various URIs or URI formats can be generated this way, including the origin form:

    -
    @@ -173,7 +173,7 @@ http://www.gnu.org/software/src-highlite --> URI = cowboy_req:uri(Req, #{host => undefined}).

    The protocol relative form:

    -
    @@ -181,14 +181,14 @@ http://www.gnu.org/software/src-highlite --> URI = cowboy_req:uri(Req, #{scheme => undefined}).

    The absolute URI without a query string:

    -
    URI = cowboy_req:uri(Req, #{qs => undefined}).

    A different host:

    -
    @@ -199,21 +199,21 @@ http://www.gnu.org/software/src-highlite -->

    Bindings are the host and path components that you chose to extract when defining the routes of your application. They are only available after the routing.

    Cowboy provides functions to retrieve one or all bindings.

    To retrieve a single value:

    -
    Value = cowboy_req:binding(userid, Req).

    When attempting to retrieve a value that was not bound, undefined will be returned. A different default value can be provided:

    -
    Value = cowboy_req:binding(userid, Req, 42).

    To retrieve everything that was bound:

    -
    @@ -222,14 +222,14 @@ http://www.gnu.org/software/src-highlite -->

    They are returned as a map, with keys being atoms.

    The Cowboy router also allows you to capture many host or path segments at once using the ... qualifier.

    To retrieve the segments captured from the host name:

    -
    HostInfo = cowboy_req:host_info(Req).

    And the path segments:

    -
    @@ -238,7 +238,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy will return undefined if ... was not used in the route.

    Query parameters

    Cowboy provides two functions to access query parameters. You can use the first to get the entire list of parameters.

    -
    @@ -250,21 +250,21 @@ http://www.gnu.org/software/src-highlite -->

    The same is true when trying to use the PHP-style suffix []. When a query string is key[]=1&key[]=2, the list returned will contain two parameters of name key[].

    When a query string is simply key, Cowboy will return the list [{<<"key">>, true}], using true to indicate that the parameter key was defined, but with no value.

    The second function Cowboy provides allows you to match out only the parameters you are interested in, and at the same time do any post processing you require using constraints. This function returns a map.

    -
    #{id := ID, lang := Lang} = cowboy_req:match_qs([id, lang], Req).

    Constraints can be applied automatically. The following snippet will crash when the id parameter is not an integer, or when the lang parameter is empty. At the same time, the value for id will be converted to an integer term:

    -
    QsMap = cowboy_req:match_qs([{id, int}, {lang, nonempty}], Req).

    A default value may also be provided. The default will be used if the lang key is not found. It will not be used if the key is found but has an empty value.

    -
    @@ -275,7 +275,7 @@ http://www.gnu.org/software/src-highlite -->

    Headers

    Header values can be retrieved either as a binary string or parsed into a more meaningful representation.

    The get the raw value:

    -
    @@ -283,21 +283,21 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy expects all header names to be provided as lowercase binary strings. This is true for both requests and responses, regardless of the underlying protocol.

    When the header is missing from the request, undefined will be returned. A different default can be provided:

    -
    HeaderVal = cowboy_req:header(<<"content-type">>, Req, <<"text/plain">>).

    All headers can be retrieved at once, either directly:

    -
    #{headers := AllHeaders} = Req.

    Or using a function:

    -
    @@ -305,7 +305,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy provides equivalent functions to parse individual headers. There is no function to parse all headers at once.

    To parse a specific header:

    -
    @@ -313,7 +313,7 @@ http://www.gnu.org/software/src-highlite -->

    An exception will be thrown if it doesn't know how to parse the given header, or if the value is invalid. The list of known headers and default values can be found in the manual.

    When the header is missing, undefined is returned. You can change the default value. Note that it should be the parsed value directly:

    -
    @@ -323,14 +323,14 @@ http://www.gnu.org/software/src-highlite -->

    Peer

    The peer address and port number for the connection can be retrieved either directly or using a function.

    To retrieve the peer directly:

    -
    #{peer := {IP, Port}} = Req.

    And using a function:

    -
    @@ -394,6 +394,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/req_body/index.html b/docs/en/cowboy/2.5/guide/req_body/index.html index 05f21d7a..eaf1425c 100644 --- a/docs/en/cowboy/2.5/guide/req_body/index.html +++ b/docs/en/cowboy/2.5/guide/req_body/index.html @@ -69,7 +69,7 @@

    Cowboy provides functions for reading the body raw, and read and parse form urlencoded or multipart bodies. The latter is covered in its own chapter.

    Request body presence

    Not all requests come with a body. You can check for the presence of a request body with this function:

    -
    @@ -79,7 +79,7 @@ http://www.gnu.org/software/src-highlite -->

    In practice, this function is rarely used. When the method is POST, PUT or PATCH, the request body is often required by the application, which should just attempt to read it directly.

    Request body length

    You can obtain the length of the body:

    -
    @@ -89,7 +89,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy will update the body length in the Req object once the body has been read completely. A length will always be returned when attempting to call this function after reading the body completely.

    Reading the body

    You can read the entire body with one function call:

    -
    @@ -98,7 +98,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy returns an ok tuple when the body has been read fully.

    By default, Cowboy will attempt to read up to 8MB of data, for up to 15 seconds. The call will return once Cowboy has read at least 8MB of data, or at the end of the 15 seconds period.

    These values can be customized. For example, to read only up to 1MB for up to 5 seconds:

    -
    @@ -106,7 +106,7 @@ http://www.gnu.org/software/src-highlite --> #{length => 1000000, period => 5000}).

    You may also disable the length limit:

    -
    @@ -116,7 +116,7 @@ http://www.gnu.org/software/src-highlite -->

    These two options can effectively be used to control the rate of transmission of the request body.

    Streaming the body

    When the body is too large, the first call will return a more tuple instead of ok. You can call the function again to read more of the body, reading it one chunk at a time.

    -
    @@ -133,7 +133,7 @@ http://www.gnu.org/software/src-highlite -->

    The length and period options can also be used. They need to be passed for every call.

    Reading a form urlencoded body

    Cowboy provides a convenient function for reading and parsing bodies sent as application/x-www-form-urlencoded.

    -
    @@ -141,7 +141,7 @@ http://www.gnu.org/software/src-highlite -->

    This function returns a list of key/values, exactly like the function cowboy_req:parse_qs/1.

    The defaults for this function are different. Cowboy will read for up to 64KB and up to 5 seconds. They can be modified:

    -
    @@ -205,6 +205,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/resource_design/index.html b/docs/en/cowboy/2.5/guide/resource_design/index.html index 70fbd9c6..1b121808 100644 --- a/docs/en/cowboy/2.5/guide/resource_design/index.html +++ b/docs/en/cowboy/2.5/guide/resource_design/index.html @@ -178,6 +178,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/resp/index.html b/docs/en/cowboy/2.5/guide/resp/index.html index bee373ed..7c8949c5 100644 --- a/docs/en/cowboy/2.5/guide/resp/index.html +++ b/docs/en/cowboy/2.5/guide/resp/index.html @@ -69,14 +69,14 @@

    Reply

    Cowboy provides three functions for sending the entire reply, depending on whether you need to set headers and body. In all cases, Cowboy will add any headers required by the protocol (for example the date header will always be sent).

    When you need to set only the status code, use cowboy_req:reply/2:

    -
    Req = cowboy_req:reply(200, Req0).

    When you need to set response headers at the same time, use cowboy_req:reply/3:

    -
    @@ -86,7 +86,7 @@ http://www.gnu.org/software/src-highlite -->

    Note that the header name must always be a lowercase binary.

    When you also need to set the response body, use cowboy_req:reply/4:

    -
    @@ -96,7 +96,7 @@ http://www.gnu.org/software/src-highlite -->

    You should always set the content-type header when the response has a body. There is however no need to set the content-length header; Cowboy does it automatically.

    The response body and the header values must be either a binary or an iolist. An iolist is a list containing binaries, characters, strings or other iolists. This allows you to build a response from different parts without having to do any concatenation:

    -
    @@ -112,7 +112,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy provides two functions for initiating a response, and an additional function for streaming the response body. Cowboy will add any required headers to the response.

    When you need to set only the status code, use cowboy_req:stream_reply/2:

    -
    @@ -124,7 +124,7 @@ http://www.gnu.org/software/src-highlite -->

    The second argument to cowboy_req:stream_body/3 indicates whether this data terminates the body. Use fin for the final flag, and nofin otherwise.

    This snippet does not set a content-type header. This is not recommended. All responses with a body should have a content-type. The header can be set beforehand, or using the cowboy_req:stream_reply/3:

    -
    @@ -139,7 +139,7 @@ http://www.gnu.org/software/src-highlite -->

    While not required by any means, it is recommended that you set the content-length header in the response if you know it in advance. This will ensure that the best response method is selected and help clients understand when the response is fully received.

    Cowboy also provides a function to send response trailers. Response trailers are semantically equivalent to the headers you send in the response, only they are sent at the end. This is especially useful to attach information to the response that could not be generated until the response body was fully generated.

    Trailer fields must be listed in the trailer header. Any field not listed might be dropped by the client or an intermediary.

    -
    @@ -160,7 +160,7 @@ http://www.gnu.org/software/src-highlite -->

    Preset response headers

    Cowboy provides functions to set response headers without immediately sending them. They are stored in the Req object and sent as part of the response when a reply function is called.

    To set response headers:

    -
    @@ -169,7 +169,7 @@ http://www.gnu.org/software/src-highlite -->

    Header names must be a lowercase binary.

    Do not use this function for setting cookies. Refer to the Cookies chapter for more information.

    To check if a response header has already been set:

    -
    @@ -177,7 +177,7 @@ http://www.gnu.org/software/src-highlite -->

    It returns true if the header was set, false otherwise.

    To delete a response header that was set previously:

    -
    @@ -202,7 +202,7 @@ http://www.gnu.org/software/src-highlite -->

    Headers given to the reply function will always override preset headers and required headers. If a header is found in two or three of these, then the one in the reply function is picked and the others are dropped.

    Similarly, preset headers will always override required headers.

    To illustrate, look at the following snippet. Cowboy by default sends the server header with the value "Cowboy". We can override it:

    -
    @@ -213,7 +213,7 @@ http://www.gnu.org/software/src-highlite -->

    Preset response body

    Cowboy provides functions to set the response body without immediately sending it. It is stored in the Req object and sent when the reply function is called.

    To set the response body:

    -
    @@ -222,7 +222,7 @@ http://www.gnu.org/software/src-highlite -->

    To check if a response body has already been set:

    -
    @@ -235,7 +235,7 @@ http://www.gnu.org/software/src-highlite -->

    The preset response body is only sent if the reply function used is cowboy_req:reply/2 or cowboy_req:reply/3.

    Sending files

    Cowboy provides a shortcut for sending files. When using cowboy_req:reply/4, or when presetting the response header, you can give a sendfile tuple to Cowboy:

    -
    @@ -244,7 +244,7 @@ http://www.gnu.org/software/src-highlite -->

    Depending on the values for Offset or Length, the entire file may be sent, or just a part of it.

    The length is required even for sending the entire file. Cowboy sends it in the content-length header.

    To send a file while replying:

    -
    @@ -265,7 +265,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy allows you to send informational responses.

    Informational responses are responses that have a status code between 100 and 199. Any number can be sent before the proper response. Sending an informational response does not change the behavior of the proper response, and clients are expected to ignore any informational response they do not understand.

    The following snippet sends a 103 informational response with some headers that are expected to be in the final response.

    -
    @@ -280,7 +280,7 @@ http://www.gnu.org/software/src-highlite -->

    To push a resource, you need to provide the same information as a client performing a request would. This includes the HTTP method, the URI and any necessary request headers.

    Cowboy by default only requires you to give the path to the resource and the request headers. The rest of the URI is taken from the current request (excluding the query string, set to empty) and the method is GET by default.

    The following snippet pushes a CSS file that is linked to in the response:

    -
    @@ -294,7 +294,7 @@ http://www.gnu.org/software/src-highlite --> "<body><p>Welcome to Erlang!</p></body></html>"], Req0).

    To override the method, scheme, host, port or query string, simply pass in a fourth argument. The following snippet uses a different host name:

    -
    @@ -361,6 +361,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/rest_flowcharts/index.html b/docs/en/cowboy/2.5/guide/rest_flowcharts/index.html index 518aa00d..8b16544f 100644 --- a/docs/en/cowboy/2.5/guide/rest_flowcharts/index.html +++ b/docs/en/cowboy/2.5/guide/rest_flowcharts/index.html @@ -176,6 +176,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/rest_handlers/index.html b/docs/en/cowboy/2.5/guide/rest_handlers/index.html index b50aa4a1..e82a7536 100644 --- a/docs/en/cowboy/2.5/guide/rest_handlers/index.html +++ b/docs/en/cowboy/2.5/guide/rest_handlers/index.html @@ -66,7 +66,7 @@

    The REST handler is the recommended way to handle HTTP requests.

    Initialization

    First, the init/2 callback is called. This callback is common to all handlers. To use REST for the current request, this function must return a cowboy_rest tuple.

    -
    @@ -274,6 +274,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/rest_principles/index.html b/docs/en/cowboy/2.5/guide/rest_principles/index.html index 8e53f6b1..f4c04fd1 100644 --- a/docs/en/cowboy/2.5/guide/rest_principles/index.html +++ b/docs/en/cowboy/2.5/guide/rest_principles/index.html @@ -150,6 +150,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/routing/index.html b/docs/en/cowboy/2.5/guide/routing/index.html index 93c53b56..18cadac8 100644 --- a/docs/en/cowboy/2.5/guide/routing/index.html +++ b/docs/en/cowboy/2.5/guide/routing/index.html @@ -68,14 +68,14 @@

    Routes need to be compiled before they can be used by Cowboy. The result of the compilation is the dispatch rules.

    Syntax

    The general structure for the routes is defined as follow.

    -
    Routes = [Host1, Host2, ... HostN].

    Each host contains matching rules for the host along with optional constraints, and a list of routes for the path component.

    -
    @@ -83,14 +83,14 @@ http://www.gnu.org/software/src-highlite --> Host2 = {HostMatch, Constraints, PathsList}.

    The list of routes for the path component is defined similar to the list of hosts.

    -
    PathsList = [Path1, Path2, ... PathN].

    Finally, each path contains matching rules for the path along with optional constraints, and gives us the handler module to be used along with its initial state.

    -
    @@ -102,7 +102,7 @@ http://www.gnu.org/software/src-highlite -->

    The match syntax is used to associate host names and paths with their respective handlers.

    The match syntax is the same for host and path with a few subtleties. Indeed, the segments separator is different, and the host is matched starting from the last segment going to the first. All examples will feature both host and path match rules and explain the differences when encountered.

    Excluding special values that we will explain at the end of this section, the simplest match value is a host or a path. It can be given as either a string() or a binary().

    -
    @@ -112,7 +112,7 @@ http://www.gnu.org/software/src-highlite --> HostMatch1 = "cowboy.example.org".

    As you can see, all paths defined this way must start with a slash character. Note that these two paths are identical as far as routing is concerned.

    -
    @@ -120,7 +120,7 @@ http://www.gnu.org/software/src-highlite --> PathMatch3 = "/path/to/resource/".

    Hosts with and without a trailing dot are equivalent for routing. Similarly, hosts with and without a leading dot are also equivalent.

    -
    @@ -130,7 +130,7 @@ http://www.gnu.org/software/src-highlite -->

    It is possible to extract segments of the host and path and to store the values in the Req object for later use. We call these kind of values bindings.

    The syntax for bindings is very simple. A segment that begins with the : character means that what follows until the end of the segment is the name of the binding in which the segment value will be stored.

    -
    @@ -139,14 +139,14 @@ http://www.gnu.org/software/src-highlite -->

    If these two end up matching when routing, you will end up with two bindings defined, subdomain and name, each containing the segment value where they were defined. For example, the URL http://test.example.org/hats/wild_cowboy_legendary/prices will result in having the value test bound to the name subdomain and the value wild_cowboy_legendary bound to the name name. They can later be retrieved using cowboy_req:binding/{2,3}. The binding name must be given as an atom.

    There is a special binding name you can use to mimic the underscore variable in Erlang. Any match against the _ binding will succeed but the data will be discarded. This is especially useful for matching against many domain names in one go.

    -
    HostMatch = "ninenines.:_".

    Similarly, it is possible to have optional segments. Anything between brackets is optional.

    -
    @@ -154,14 +154,14 @@ http://www.gnu.org/software/src-highlite --> HostMatch = "[www.]ninenines.eu".

    You can also have imbricated optional segments.

    -
    PathMatch = "/hats/[page/[:number]]".

    You can retrieve the rest of the host or path using [...]. In the case of hosts it will match anything before, in the case of paths anything after the previously matched segments. It is a special case of optional segments, in that it can have zero, one or many segments. You can then find the segments using cowboy_req:host_info/1 and cowboy_req:path_info/1 respectively. They will be represented as a list of segments.

    -
    @@ -169,21 +169,21 @@ http://www.gnu.org/software/src-highlite --> HostMatch = "[...]ninenines.eu".

    If a binding appears twice in the routing rules, then the match will succeed only if they share the same value. This copies the Erlang pattern matching behavior.

    -
    PathMatch = "/hats/:name/:name".

    This is also true when an optional segment is present. In this case the two values must be identical only if the segment is available.

    -
    PathMatch = "/hats/:name/[:name]".

    If a binding is defined in both the host and path, then they must also share the same value.

    -
    @@ -191,7 +191,7 @@ http://www.gnu.org/software/src-highlite --> HostMatch = ":user.github.com".

    Finally, there are two special match values that can be used. The first is the atom '_' which will match any host or path.

    -
    @@ -199,7 +199,7 @@ http://www.gnu.org/software/src-highlite --> HostMatch = '_'.

    The second is the special host match "*" which will match the wildcard path, generally used alongside the OPTIONS method.

    -
    @@ -212,7 +212,7 @@ http://www.gnu.org/software/src-highlite -->

    Compilation

    The routes must be compiled before Cowboy can use them. The compilation step normalizes the routes to simplify the code and speed up the execution, but the routes are still looked up one by one in the end. Faster compilation strategies could be to compile the routes directly to Erlang code, but would require heavier dependencies.

    To compile routes, just call the appropriate function:

    -
    @@ -228,7 +228,7 @@ http://www.gnu.org/software/src-highlite -->

    Live update

    You can use the cowboy:set_env/3 function for updating the dispatch list used by routing. This will apply to all new connections accepted by the listener:

    -
    @@ -293,6 +293,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/specs/index.html b/docs/en/cowboy/2.5/guide/specs/index.html index 1585c179..16b5ad36 100644 --- a/docs/en/cowboy/2.5/guide/specs/index.html +++ b/docs/en/cowboy/2.5/guide/specs/index.html @@ -459,6 +459,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/static_files/index.html b/docs/en/cowboy/2.5/guide/static_files/index.html index 4aea55d0..37dcd127 100644 --- a/docs/en/cowboy/2.5/guide/static_files/index.html +++ b/docs/en/cowboy/2.5/guide/static_files/index.html @@ -68,14 +68,14 @@

    Serve one file

    You can use the static handler to serve one specific file from an application's private directory. This is particularly useful to serve an index.html file when the client requests the / path, for example. The path configured is relative to the given application's private directory.

    The following rule will serve the file static/index.html from the application my_app's priv directory whenever the path / is accessed:

    -
    {"/", cowboy_static, {priv_file, my_app, "static/index.html"}}

    You can also specify the absolute path to a file, or the path to the file relative to the current directory:

    -
    @@ -85,14 +85,14 @@ http://www.gnu.org/software/src-highlite -->

    You can also use the static handler to serve all files that can be found in the configured directory. The handler will use the path_info information to resolve the file location, which means that your route must end with a [...] pattern for it to work. All files are served, including the ones that may be found in subfolders.

    You can specify the directory relative to an application's private directory.

    The following rule will serve any file found in the application my_app's priv directory inside the static/assets folder whenever the requested path begins with /assets/:

    -
    {"/assets/[...]", cowboy_static, {priv_dir, my_app, "static/assets"}}

    You can also specify the absolute path to the directory or set it relative to the current directory:

    -
    @@ -103,7 +103,7 @@ http://www.gnu.org/software/src-highlite -->

    You can override the function that figures out the mimetype of the static files. It can be useful when Cowboy is missing a mimetype you need to handle, or when you want to reduce the list to make lookups faster. You can also give a hard-coded mimetype that will be used unconditionally.

    Cowboy comes with two functions built-in. The default function only handles common file types used when building Web applications. The other function is an extensive list of hundreds of mimetypes that should cover almost any need you may have. You can of course create your own function.

    To use the default function, you should not have to configure anything, as it is the default. If you insist, though, the following will do the job:

    -
    @@ -112,7 +112,7 @@ http://www.gnu.org/software/src-highlite -->

    As you can see, there is an optional field that may contain a list of less used options, like mimetypes or etag. All option types have this optional field.

    To use the function that will detect almost any mimetype, the following configuration will do:

    -
    @@ -120,7 +120,7 @@ http://www.gnu.org/software/src-highlite --> [{mimetypes, cow_mimetypes, all}]}}

    You probably noticed the pattern by now. The configuration expects a module and a function name, so you can use any of your own functions instead:

    -
    @@ -130,7 +130,7 @@ http://www.gnu.org/software/src-highlite -->

    The function that performs the mimetype detection receives a single argument that is the path to the file on disk. It is recommended to return the mimetype in tuple form, although a binary string is also allowed (but will require extra processing). If the function can't figure out the mimetype, then it should return {<<"application">>, <<"octet-stream">>, []}.

    When the static handler fails to find the extension, it will send the file as application/octet-stream. A browser receiving such file will attempt to download it directly to disk.

    Finally, the mimetype can be hard-coded for all files. This is especially useful in combination with the file and priv_file options as it avoids needless computation:

    -
    @@ -140,7 +140,7 @@ http://www.gnu.org/software/src-highlite -->

    Generate an etag

    By default, the static handler will generate an etag header value based on the size and modified time. This solution can not be applied to all systems though. It would perform rather poorly over a cluster of nodes, for example, as the file metadata will vary from server to server, giving a different etag on each server.

    You can however change the way the etag is calculated:

    -
    @@ -149,7 +149,7 @@ http://www.gnu.org/software/src-highlite -->

    This function will receive three arguments: the path to the file on disk, the size of the file and the last modification time. In a distributed setup, you would typically use the file path to retrieve an etag value that is identical across all your servers.

    You can also completely disable etag handling:

    -
    @@ -213,6 +213,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/streams/index.html b/docs/en/cowboy/2.5/guide/streams/index.html index 62ed6ecf..de2c0fbe 100644 --- a/docs/en/cowboy/2.5/guide/streams/index.html +++ b/docs/en/cowboy/2.5/guide/streams/index.html @@ -135,6 +135,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/ws_handlers/index.html b/docs/en/cowboy/2.5/guide/ws_handlers/index.html index 0629acd4..de885e51 100644 --- a/docs/en/cowboy/2.5/guide/ws_handlers/index.html +++ b/docs/en/cowboy/2.5/guide/ws_handlers/index.html @@ -66,7 +66,7 @@

    As Websocket connections are established through the HTTP/1.1 upgrade mechanism, Websocket handlers need to be able to first receive the HTTP request for the upgrade, before switching to Websocket and taking over the connection. They can then receive or send Websocket frames, handle incoming Erlang messages or close the connection.

    Upgrade

    The init/2 callback is called when the request is received. To establish a Websocket connection, you must switch to the cowboy_websocket module:

    -
    @@ -82,7 +82,7 @@ http://www.gnu.org/software/src-highlite -->

    If the server only understands MQTT it can return:

    sec-websocket-protocol: mqtt

    This selection must be done in init/2. An example usage could be:

    -
    @@ -106,7 +106,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy has separate processes for handling the connection and requests. Because Websocket takes over the connection, the Websocket protocol handling occurs in a different process than the request handling.

    This is reflected in the different callbacks Websocket handlers have. The init/2 callback is called from the temporary request process and the websocket_ callbacks from the connection process.

    This means that some initialization cannot be done from init/2. Anything that would require the current pid, or be tied to the current pid, will not work as intended. The optional websocket_init/1 can be used instead:

    -
    @@ -115,7 +115,7 @@ http://www.gnu.org/software/src-highlite --> {ok, State}.

    All Websocket callbacks share the same return values. This means that we can send frames to the client right after the upgrade:

    -
    @@ -126,7 +126,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy will call websocket_handle/2 whenever a text, binary, ping or pong frame arrives from the client.

    The handler can handle or ignore the frames. It can also send frames back to the client or stop the connection.

    The following snippet echoes back any text frame received and ignores all others:

    -
    @@ -140,7 +140,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy will call websocket_info/2 whenever an Erlang message arrives.

    The handler can handle or ignore the messages. It can also send frames to the client or stop the connection.

    The following snippet forwards log messages to the client and ignores all others:

    -
    @@ -155,7 +155,7 @@ http://www.gnu.org/software/src-highlite -->

    All websocket_ callbacks share return values. They may send zero, one or many frames to the client.

    To send nothing, just return an ok tuple:

    -
    @@ -163,7 +163,7 @@ http://www.gnu.org/software/src-highlite --> {ok, State}.

    To send one frame, return a reply tuple with the frame to send:

    -
    @@ -172,7 +172,7 @@ http://www.gnu.org/software/src-highlite -->

    You can send frames of any type: text, binary, ping, pong or close frames.

    To send many frames at once, return a reply tuple with the list of frames to send:

    -
    @@ -189,7 +189,7 @@ http://www.gnu.org/software/src-highlite -->

    Cowboy does not send ping frames itself. The handler can do it if required. A better solution in most cases is to let the client handle pings. Doing it from the handler would imply having an additional timer per connection and this can be a considerable cost for servers that need to handle large numbers of connections.

    Cowboy can be configured to close idle connections automatically. It is highly recommended to configure a timeout here, to avoid having processes linger longer than needed.

    The init/2 callback can set the timeout to be used for the connection. For example, this would make Cowboy close connections idle for more than 30 seconds:

    -
    @@ -200,7 +200,7 @@ http://www.gnu.org/software/src-highlite -->

    This value cannot be changed once it is set. It defaults to 60000.

    Limiting frame sizes

    Cowboy accepts frames of any size by default. You should limit the size depending on what your handler may handle. You can do this via the init/2 callback:

    -
    @@ -212,7 +212,7 @@ http://www.gnu.org/software/src-highlite -->

    Saving memory

    The Websocket connection process can be set to hibernate after the callback returns.

    Simply add an hibernate field to the ok or reply tuples:

    -
    @@ -229,7 +229,7 @@ http://www.gnu.org/software/src-highlite -->

    Closing the connection

    The connection can be closed at any time, either by telling Cowboy to stop it or by sending a close frame.

    To tell Cowboy to close the connection, use a stop tuple:

    -
    @@ -238,7 +238,7 @@ http://www.gnu.org/software/src-highlite -->

    Sending a close frame will immediately initiate the closing of the Websocket connection. Note that when sending a list of frames that include a close frame, any frame found after the close frame will not be sent.

    The following example sends a close frame with a reason message:

    -
    @@ -302,6 +302,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/guide/ws_protocol/index.html b/docs/en/cowboy/2.5/guide/ws_protocol/index.html index 34b2b439..bad44867 100644 --- a/docs/en/cowboy/2.5/guide/ws_protocol/index.html +++ b/docs/en/cowboy/2.5/guide/ws_protocol/index.html @@ -134,6 +134,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy.set_env/index.html b/docs/en/cowboy/2.5/manual/cowboy.set_env/index.html index 8de10f73..4992edb4 100644 --- a/docs/en/cowboy/2.5/manual/cowboy.set_env/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy.set_env/index.html @@ -65,7 +65,7 @@

    Name

    cowboy:set_env - Update a listener's environment value

    Description

    -
    @@ -99,7 +99,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Update a listener's routes
    -
    @@ -149,6 +149,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy.start_clear/index.html b/docs/en/cowboy/2.5/manual/cowboy.start_clear/index.html index fc6441e7..9df424f2 100644 --- a/docs/en/cowboy/2.5/manual/cowboy.start_clear/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy.start_clear/index.html @@ -65,7 +65,7 @@

    Name

    cowboy:start_clear - Listen for connections using plain TCP

    Description

    -
    @@ -103,7 +103,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Start a listener
    -
    @@ -118,7 +118,7 @@ http://www.gnu.org/software/src-highlite --> }).
    Start a listener on a random port
    -
    @@ -167,6 +167,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy.start_tls/index.html b/docs/en/cowboy/2.5/manual/cowboy.start_tls/index.html index 43bb1278..ad742714 100644 --- a/docs/en/cowboy/2.5/manual/cowboy.start_tls/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy.start_tls/index.html @@ -65,7 +65,7 @@

    Name

    cowboy:start_tls - Listen for connections using TLS

    Description

    -
    @@ -103,7 +103,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Start a listener
    -
    @@ -121,7 +121,7 @@ http://www.gnu.org/software/src-highlite --> }).
    Start a listener on a random port
    -
    @@ -172,6 +172,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy.stop_listener/index.html b/docs/en/cowboy/2.5/manual/cowboy.stop_listener/index.html index 69190061..8ef64bb0 100644 --- a/docs/en/cowboy/2.5/manual/cowboy.stop_listener/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy.stop_listener/index.html @@ -65,7 +65,7 @@

    Name

    cowboy:stop_listener - Stop the given listener

    Description

    -
    @@ -89,7 +89,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Stop a listener
    -
    @@ -132,6 +132,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy/index.html b/docs/en/cowboy/2.5/manual/cowboy/index.html index 6d781461..f9a8bf20 100644 --- a/docs/en/cowboy/2.5/manual/cowboy/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy/index.html @@ -78,7 +78,7 @@

    Types

    fields()

    -
    @@ -94,7 +94,7 @@ http://www.gnu.org/software/src-highlite -->

    Fields description for match operations.

    This type is used in cowboy_router(3) for matching bindings and in the match functions found in cowboy_req(3).

    http_headers()

    -
    @@ -102,7 +102,7 @@ http://www.gnu.org/software/src-highlite -->

    HTTP headers.

    http_status()

    -
    @@ -111,7 +111,7 @@ http://www.gnu.org/software/src-highlite -->

    HTTP response status.

    A binary status can be used to set a reason phrase. Note however that HTTP/2 only sends the status code and drops the reason phrase entirely.

    http_version()

    -
    @@ -120,7 +120,7 @@ http://www.gnu.org/software/src-highlite -->

    HTTP version.

    Note that semantically, HTTP/1.1 and HTTP/2 are equivalent.

    opts()

    -
    @@ -166,6 +166,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_app/index.html b/docs/en/cowboy/2.5/manual/cowboy_app/index.html index 794ae9f3..06cdc437 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_app/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_app/index.html @@ -122,7 +122,7 @@

    All these applications must be started before the cowboy application. To start Cowboy and all dependencies at once:

    -
    @@ -167,6 +167,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_constraints.int/index.html b/docs/en/cowboy/2.5/manual/cowboy_constraints.int/index.html index 74ad72a7..7965fbf6 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_constraints.int/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_constraints.int/index.html @@ -66,7 +66,7 @@

    cowboy_constraints:int - Integer constraint

    Description

    Constraint functions implement a number of different operations.

    -
    @@ -76,14 +76,14 @@ http://www.gnu.org/software/src-highlite --> Int :: integer()

    Validate and convert the text representation of an integer.

    -
    int(reverse, Int) -> {ok, Bin} | {error, not_an_integer}

    Convert an integer back to its text representation.

    -
    @@ -142,6 +142,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_constraints.nonempty/index.html b/docs/en/cowboy/2.5/manual/cowboy_constraints.nonempty/index.html index d754344f..f0489d55 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_constraints.nonempty/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_constraints.nonempty/index.html @@ -66,14 +66,14 @@

    cowboy_constraints:nonempty - Non-empty constraint

    Description

    Constraint functions implement a number of different operations.

    -
    nonempty(forward | reverse, <<>>) -> {error, empty}

    Reject empty values.

    -
    @@ -82,7 +82,7 @@ http://www.gnu.org/software/src-highlite --> Bin :: binary()

    Accept any other binary values.

    -
    @@ -141,6 +141,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_constraints/index.html b/docs/en/cowboy/2.5/manual/cowboy_constraints/index.html index 19c5c790..2e430e94 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_constraints/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_constraints/index.html @@ -76,7 +76,7 @@

    Types

    constraint()

    -
    @@ -85,7 +85,7 @@ http://www.gnu.org/software/src-highlite -->

    A constraint function.

    The atom constraints are built-in, see the corresponding function in the exports list above.

    reason()

    -
    @@ -133,6 +133,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_handler.terminate/index.html b/docs/en/cowboy/2.5/manual/cowboy_handler.terminate/index.html index 27a25f03..63337ecc 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_handler.terminate/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_handler.terminate/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_handler:terminate - Terminate the handler

    Description

    -
    @@ -101,7 +101,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Terminate a handler normally
    -
    @@ -144,6 +144,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_handler/index.html b/docs/en/cowboy/2.5/manual/cowboy_handler/index.html index 708d2aef..8c28b764 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_handler/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_handler/index.html @@ -70,7 +70,7 @@

    This module also defines a callback interface for handling HTTP requests.

    Callbacks

    Plain HTTP handlers implement the following interface:

    -
    @@ -136,6 +136,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_http/index.html b/docs/en/cowboy/2.5/manual/cowboy_http/index.html index e1773d71..0ab22783 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_http/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_http/index.html @@ -69,7 +69,7 @@

    Options

    -
    @@ -212,6 +212,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_http2/index.html b/docs/en/cowboy/2.5/manual/cowboy_http2/index.html index ce227a99..9e5c49c6 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_http2/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_http2/index.html @@ -69,7 +69,7 @@

    Options

    -
    @@ -192,6 +192,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_loop/index.html b/docs/en/cowboy/2.5/manual/cowboy_loop/index.html index 7f0a7c58..6e43fb56 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_loop/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_loop/index.html @@ -75,7 +75,7 @@

    Callbacks

    Loop handlers implement the following interface:

    -
    @@ -150,6 +150,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_middleware/index.html b/docs/en/cowboy/2.5/manual/cowboy_middleware/index.html index a40ecedd..8425e227 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_middleware/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_middleware/index.html @@ -69,7 +69,7 @@

    Middlewares process the request sequentially in the order they are configured.

    Callbacks

    Middlewares implement the following interface:

    -
    @@ -94,7 +94,7 @@ http://www.gnu.org/software/src-highlite -->

    Types

    env()

    -
    @@ -146,6 +146,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.binding/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.binding/index.html index c45b607d..be1e839f 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.binding/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.binding/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:binding - Access a value bound from the route

    Description

    -
    @@ -98,7 +98,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the username from the path
    -
    @@ -106,7 +106,7 @@ http://www.gnu.org/software/src-highlite --> Username = cowboy_req:binding(user, Req).
    Get the branch name, with a default
    -
    @@ -150,6 +150,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.bindings/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.bindings/index.html index f30118be..78f54f07 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.bindings/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.bindings/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:bindings - Access all values bound from the route

    Description

    -
    @@ -87,7 +87,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get all bindings
    -
    @@ -130,6 +130,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.body_length/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.body_length/index.html index b7fa230a..1ed902d7 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.body_length/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.body_length/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:body_length - Body length

    Description

    -
    @@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the body length
    -
    @@ -131,6 +131,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.cert/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.cert/index.html index 459137e3..8c383b58 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.cert/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.cert/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:cert - Client TLS certificate

    Description

    -
    @@ -73,7 +73,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the peer's TLS certificate.

    Using the default configuration this function will always return undefined. You need to explicitly configure Cowboy to request the client certificate. To do this you need to set the verify transport option to verify_peer:

    -
    @@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite -->

    You may also want to customize the verify_fun function. Please consult the ssl application's manual for more details.

    TCP connections do not allow a certificate and this function will therefore always return undefined.

    The certificate can also be obtained using pattern matching:

    -
    @@ -107,7 +107,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the client TLS certificate.
    -
    @@ -150,6 +150,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.delete_resp_header/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.delete_resp_header/index.html index a7ca96ae..729cd996 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.delete_resp_header/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.delete_resp_header/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:delete_resp_header - Delete a response header

    Description

    -
    @@ -92,7 +92,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Remove the content-type header from the response
    -
    @@ -135,6 +135,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.has_body/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.has_body/index.html index 2849a63c..f108a680 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.has_body/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.has_body/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:has_body - Is there a request body?

    Description

    -
    @@ -85,7 +85,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Ensure the request has a body
    -
    @@ -128,6 +128,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.has_resp_body/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.has_resp_body/index.html index fee05c17..aa6e2132 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.has_resp_body/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.has_resp_body/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:has_resp_body - Is there a response body?

    Description

    -
    @@ -86,7 +86,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Check whether a body has been set
    -
    @@ -133,6 +133,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.has_resp_header/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.has_resp_header/index.html index 7e8da48e..04368109 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.has_resp_header/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.has_resp_header/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:has_resp_header - Is the given response header set?

    Description

    -
    @@ -91,7 +91,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Check whether the content-type header has been set
    -
    @@ -136,6 +136,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.header/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.header/index.html index ecff8158..afd666df 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.header/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.header/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:header - HTTP header

    Description

    -
    @@ -79,7 +79,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the value for the given HTTP header.

    The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly.

    Headers can also be obtained using pattern matching:

    -
    @@ -107,14 +107,14 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the accept header
    -
    Accept = cowboy_req:header(<<"accept">>, Req).
    Get the content-length header with a default value
    -
    @@ -157,6 +157,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.headers/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.headers/index.html index f608b189..6628a837 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.headers/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.headers/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:headers - HTTP headers

    Description

    -
    @@ -73,7 +73,7 @@ http://www.gnu.org/software/src-highlite -->

    Return all request headers.

    Request headers can also be obtained using pattern matching:

    -
    @@ -94,7 +94,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get all headers
    -
    @@ -137,6 +137,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.host/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.host/index.html index 3b64d263..737363e5 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.host/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.host/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:host - URI host name

    Description

    -
    @@ -73,7 +73,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the host name of the effective request URI.

    The host name can also be obtained using pattern matching:

    -
    @@ -94,7 +94,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the effective request URI's host name
    -
    @@ -137,6 +137,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.host_info/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.host_info/index.html index f6ea8938..4d4f1cf0 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.host_info/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.host_info/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:host_info - Access the route's heading host segments

    Description

    -
    @@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the host_info tokens
    -
    @@ -131,6 +131,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.inform/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.inform/index.html index 652c09a3..9649be48 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.inform/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.inform/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:inform - Send an informational response

    Description

    -
    @@ -102,14 +102,14 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Send an informational response
    -
    Req = cowboy_req:inform(102, Req0).
    Send an informational response with headers
    -
    @@ -155,6 +155,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.match_cookies/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.match_cookies/index.html index 2cb8a0c7..d3288a42 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.match_cookies/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.match_cookies/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:match_cookies - Match cookies against constraints

    Description

    -
    @@ -95,7 +95,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Match fields
    -
    @@ -104,7 +104,7 @@ http://www.gnu.org/software/src-highlite --> = cowboy_req:match_cookies([id, lang], Req).
    Match fields and apply constraints
    -
    @@ -113,7 +113,7 @@ http://www.gnu.org/software/src-highlite --> = cowboy_req:match_cookies([{id, int}, {lang, nonempty}], Req).
    Match fields with default values
    -
    @@ -157,6 +157,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.match_qs/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.match_qs/index.html index 3c421d33..1fc9a0b8 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.match_qs/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.match_qs/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:match_qs - Match the query string against constraints

    Description

    -
    @@ -95,7 +95,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Match fields
    -
    @@ -104,7 +104,7 @@ http://www.gnu.org/software/src-highlite --> = cowboy_req:match_qs([id, lang], Req).
    Match fields and apply constraints
    -
    @@ -113,7 +113,7 @@ http://www.gnu.org/software/src-highlite --> = cowboy_req:match_qs([{id, int}, {lang, nonempty}], Req).
    Match fields with default values
    -
    @@ -157,6 +157,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.method/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.method/index.html index 5ea7e6be..0bb7adbe 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.method/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.method/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:method - HTTP method

    Description

    -
    @@ -73,7 +73,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the request's HTTP method.

    The method can also be obtained using pattern matching:

    -
    @@ -94,14 +94,14 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Ensure the request's method is GET
    -
    <<"GET">> = cowboy_req:method(Req).
    Allow methods from list
    -
    @@ -148,6 +148,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.parse_cookies/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.parse_cookies/index.html index 64253c48..266c4d00 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.parse_cookies/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.parse_cookies/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:parse_cookies - Parse cookie headers

    Description

    -
    @@ -93,7 +93,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Look for a specific cookie
    -
    @@ -137,6 +137,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.parse_header/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.parse_header/index.html index 5e4198d3..97e45fcc 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.parse_header/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.parse_header/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:parse_header - Parse the given HTTP header

    Description

    -
    @@ -96,7 +96,7 @@ http://www.gnu.org/software/src-highlite -->

    Headers

    The following snippets detail the types returned by the different headers. Unless mentioned otherwise, the default value when the header is missing will be undefined:

    accept
    -
    @@ -112,7 +112,7 @@ http://www.gnu.org/software/src-highlite --> Value :: binary() %% case sensitive
    accept-charset, accept-encoding and accept-language
    -
    @@ -125,7 +125,7 @@ http://www.gnu.org/software/src-highlite --> Quality :: 0..1000
    authorization
    -
    @@ -136,7 +136,7 @@ http://www.gnu.org/software/src-highlite -->
    content-length
    -
    @@ -144,7 +144,7 @@ http://www.gnu.org/software/src-highlite -->

    When the content-length header is missing, 0 is returned.

    content-type
    -
    @@ -159,7 +159,7 @@ http://www.gnu.org/software/src-highlite -->

    Note that the value for the charset parameter is case insensitive and returned as a lowercase binary string.

    cookie
    -
    @@ -171,14 +171,14 @@ http://www.gnu.org/software/src-highlite -->

    When the cookie header is missing, [] is returned.

    While an empty cookie header is not valid, some clients do send it. Cowboy will in this case also return [].

    expect
    -
    parse_header(<<"expect">>, Req) -> continue
    if-match and if-none-match
    -
    @@ -190,14 +190,14 @@ http://www.gnu.org/software/src-highlite --> OpaqueTag :: binary() %% case sensitive
    if-modified-since and if-unmodified-since
    -
    parse_header(Name, Req) -> calendar:datetime()
    range
    -
    @@ -208,7 +208,7 @@ http://www.gnu.org/software/src-highlite --> Final :: neg_integer()
    sec-websocket-extensions
    -
    @@ -221,7 +221,7 @@ http://www.gnu.org/software/src-highlite --> Value :: binary() %% case sensitive
    sec-websocket-protocol and upgrade
    -
    @@ -232,7 +232,7 @@ http://www.gnu.org/software/src-highlite --> Token :: binary() %% case insensitive
    x-forwarded-for
    -
    @@ -241,7 +241,7 @@ http://www.gnu.org/software/src-highlite --> Token :: binary() %% case sensitive
    Unknown headers
    -
    @@ -255,7 +255,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Parse the accept header with a custom default value
    -
    @@ -264,7 +264,7 @@ http://www.gnu.org/software/src-highlite --> [{{ <<"*">>, <<"*">>, []}, 1000, []}]).
    Parse the content-length header
    -
    @@ -308,6 +308,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.parse_qs/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.parse_qs/index.html index 82dc5c89..fb53b1dc 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.parse_qs/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.parse_qs/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:parse_qs - Parse the query string

    Description

    -
    @@ -100,7 +100,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Parse the query string and convert the keys to atoms
    -
    @@ -145,6 +145,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.path/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.path/index.html index 828501e3..a2e849d7 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.path/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.path/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:path - URI path

    Description

    -
    @@ -73,7 +73,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the path of the effective request URI.

    The path can also be obtained using pattern matching:

    -
    @@ -94,7 +94,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the effective request URI's path
    -
    @@ -137,6 +137,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.path_info/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.path_info/index.html index 80edcfd8..ba74e12d 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.path_info/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.path_info/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:path_info - Access the route's trailing path segments

    Description

    -
    @@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the path_info tokens
    -
    @@ -131,6 +131,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.peer/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.peer/index.html index 6319a5eb..1077f510 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.peer/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.peer/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:peer - Peer address and port

    Description

    -
    @@ -75,7 +75,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the peer's IP address and port number.

    The peer information can also be obtained using pattern matching:

    -
    @@ -98,7 +98,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the peer IP address and port number.
    -
    @@ -141,6 +141,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.port/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.port/index.html index e6c382b2..d6d52a5d 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.port/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.port/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:port - URI port number

    Description

    -
    @@ -74,7 +74,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the port number of the effective request URI.

    Note that the port number returned by this function is obtained by parsing the host header. It may be different from the port the peer used to connect to Cowboy.

    The port number can also be obtained using pattern matching:

    -
    @@ -95,7 +95,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the effective request URI's port number
    -
    @@ -138,6 +138,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.push/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.push/index.html index 0315f389..68289aa0 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.push/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.push/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:push - Push a resource to the client

    Description

    -
    @@ -110,7 +110,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Push a resource
    -
    @@ -119,7 +119,7 @@ http://www.gnu.org/software/src-highlite --> }, Req),
    Push a resource with a custom host
    -
    @@ -164,6 +164,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.qs/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.qs/index.html index ec8c2469..c602c346 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.qs/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.qs/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:qs - URI query string

    Description

    -
    @@ -73,7 +73,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the query string of the effective request URI.

    The query string can also be obtained using pattern matching:

    -
    @@ -94,7 +94,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the effective request URI's query string
    -
    @@ -137,6 +137,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.read_and_match_urlencoded_body/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.read_and_match_urlencoded_body/index.html index 9f1c9a54..256f28b4 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.read_and_match_urlencoded_body/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.read_and_match_urlencoded_body/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:read_and_match_urlencoded_body - Read, parse and match a urlencoded request body against constraints

    Description

    -
    @@ -115,7 +115,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Match fields
    -
    @@ -125,7 +125,7 @@ http://www.gnu.org/software/src-highlite --> [id, lang], Req).
    Match fields and apply constraints
    -
    @@ -135,7 +135,7 @@ http://www.gnu.org/software/src-highlite --> [{id, int}, {lang, nonempty}], Req).
    Match fields with default values
    -
    @@ -144,7 +144,7 @@ http://www.gnu.org/software/src-highlite --> [{lang, [], <<"en-US">>}], Req).
    Allow large urlencoded bodies
    -
    @@ -188,6 +188,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.read_body/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.read_body/index.html index 901195b3..aae2b9de 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.read_body/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.read_body/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:read_body - Read the request body

    Description

    -
    @@ -108,7 +108,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Read the entire body
    -
    @@ -119,7 +119,7 @@ http://www.gnu.org/software/src-highlite --> end.
    Read the body in small chunks
    -
    @@ -162,6 +162,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.read_part/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.read_part/index.html index bb91c5bb..acc8ecab 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.read_part/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.read_part/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:read_part - Read the next multipart headers

    Description

    -
    @@ -106,7 +106,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Read all parts
    -
    @@ -128,7 +128,7 @@ http://www.gnu.org/software/src-highlite --> end.
    Read all part headers, skipping bodies
    -
    @@ -141,7 +141,7 @@ http://www.gnu.org/software/src-highlite --> end.
    Read a part header in larger chunks
    -
    @@ -184,6 +184,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.read_part_body/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.read_part_body/index.html index 5ca442e8..42c1e806 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.read_part_body/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.read_part_body/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:read_part_body - Read the current part's body

    Description

    -
    @@ -104,7 +104,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Read a full part's body
    -
    @@ -117,7 +117,7 @@ http://www.gnu.org/software/src-highlite --> end.
    Ensure a part's body is smaller than 64KB
    -
    @@ -160,6 +160,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.read_urlencoded_body/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.read_urlencoded_body/index.html index b29c677d..07e1c876 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.read_urlencoded_body/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.read_urlencoded_body/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:read_urlencoded_body - Read and parse a urlencoded request body

    Description

    -
    @@ -103,7 +103,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Read a urlencoded body
    -
    @@ -111,7 +111,7 @@ http://www.gnu.org/software/src-highlite --> {_, Lang} = lists:keyfind(<<"lang">>, 1, Body).
    Allow large urlencoded bodies
    -
    @@ -154,6 +154,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.reply/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.reply/index.html index 1d356fbf..862c0e4f 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.reply/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.reply/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:reply - Send the response

    Description

    -
    @@ -115,14 +115,14 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Reply
    -
    Req = cowboy_req:reply(404, Req0).
    Reply with custom headers
    -
    @@ -131,7 +131,7 @@ http://www.gnu.org/software/src-highlite --> }, Req0).
    Reply with custom headers and a body
    -
    @@ -176,6 +176,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.resp_header/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.resp_header/index.html index c100dfdf..9158c937 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.resp_header/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.resp_header/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:resp_header - Response header

    Description

    -
    @@ -98,14 +98,14 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the content-type response header
    -
    Type = cowboy_req:resp_header(<<"content-type">>, Req).
    Get the content-type response header with a default value
    -
    @@ -148,6 +148,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.resp_headers/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.resp_headers/index.html index bc2bb7ed..0b56cfed 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.resp_headers/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.resp_headers/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:resp_headers - Response headers

    Description

    -
    @@ -85,7 +85,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get all response headers
    -
    @@ -128,6 +128,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.scheme/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.scheme/index.html index bad23479..57838af9 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.scheme/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.scheme/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:scheme - URI scheme

    Description

    -
    @@ -73,7 +73,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the scheme of the effective request URI.

    The scheme can also be obtained using pattern matching:

    -
    @@ -93,7 +93,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Redirect HTTP to HTTPS
    -
    @@ -142,6 +142,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_body/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_body/index.html index 4f7d6269..bf437e37 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_body/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_body/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:set_resp_body - Set the response body

    Description

    -
    @@ -98,14 +98,14 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Set the response body
    -
    Req = cowboy_req:set_resp_body(<<"Hello world!">>, Req0).
    Set the response body as an iolist
    -
    @@ -118,7 +118,7 @@ http://www.gnu.org/software/src-highlite --> ], Req0).
    Tell Cowboy to send data from a file
    -
    @@ -126,7 +126,7 @@ http://www.gnu.org/software/src-highlite --> Req = cowboy_req:set_resp_body({sendfile, 0, Size, Filename}, Req0).
    Clear any previously set response body
    -
    @@ -169,6 +169,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_cookie/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_cookie/index.html index 084753cd..34ffb408 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_cookie/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_cookie/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:set_resp_cookie - Set a cookie

    Description

    -
    @@ -108,7 +108,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Set a session cookie
    -
    @@ -116,7 +116,7 @@ http://www.gnu.org/software/src-highlite --> Req = cowboy_req:set_resp_cookie(<<"sessionid">>, SessionID, Req0).
    Set a cookie with an expiration time
    -
    @@ -124,7 +124,7 @@ http://www.gnu.org/software/src-highlite --> Req0, #{max_age => 3600}).
    Delete a cookie
    -
    @@ -132,7 +132,7 @@ http://www.gnu.org/software/src-highlite --> Req0, #{max_age => 0}).
    Set a cookie for a specific domain and path
    -
    @@ -140,7 +140,7 @@ http://www.gnu.org/software/src-highlite --> Req0, #{domain => "my.example.org", path => "/account"}).
    Restrict a cookie to HTTPS
    -
    @@ -149,7 +149,7 @@ http://www.gnu.org/software/src-highlite --> Req0, #{secure => true}).
    Restrict a cookie to HTTP
    -
    @@ -194,6 +194,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_header/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_header/index.html index 0b53cd6b..1c5cdaf4 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_header/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_header/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:set_resp_header - Set a response header

    Description

    -
    @@ -99,14 +99,14 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Set a header in the response
    -
    Req = cowboy_req:set_resp_header(<<"allow">>, "GET", Req0).
    Construct a header using iolists
    -
    @@ -150,6 +150,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_headers/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_headers/index.html index d8bcb962..fd317a45 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_headers/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.set_resp_headers/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:set_resp_headers - Set several response headers

    Description

    -
    @@ -95,7 +95,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Set several response headers
    -
    @@ -141,6 +141,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.sock/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.sock/index.html index 416c0fb7..06dd2cf1 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.sock/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.sock/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:sock - Socket address and port

    Description

    -
    @@ -75,7 +75,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the socket's IP address and port number.

    The socket information can also be obtained using pattern matching:

    -
    @@ -94,7 +94,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the socket's IP address and port number.
    -
    @@ -137,6 +137,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.stream_body/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.stream_body/index.html index b7189d1e..16e5c1f5 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.stream_body/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.stream_body/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:stream_body - Stream the response body

    Description

    -
    @@ -98,7 +98,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Stream the response body
    -
    @@ -146,6 +146,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.stream_events/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.stream_events/index.html index 42b15c3a..797f277b 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.stream_events/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.stream_events/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:stream_events - Stream events

    Description

    -
    @@ -107,7 +107,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Stream events
    -
    @@ -162,6 +162,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.stream_reply/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.stream_reply/index.html index 79d4a3a2..16381b11 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.stream_reply/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.stream_reply/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:stream_reply - Send the response headers

    Description

    -
    @@ -110,14 +110,14 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Initiate the response
    -
    Req = cowboy_req:stream_reply(200, Req0).
    Stream the response with custom headers
    -
    @@ -165,6 +165,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.stream_trailers/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.stream_trailers/index.html index 4895de92..b0175f7c 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.stream_trailers/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.stream_trailers/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:stream_trailers - Send the response trailers

    Description

    -
    @@ -92,7 +92,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Stream a response body with trailers
    -
    @@ -145,6 +145,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.uri/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.uri/index.html index 4e9c5fa3..eedc1dd6 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.uri/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.uri/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:uri - Reconstructed URI

    Description

    -
    @@ -113,7 +113,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    With an effective request URI http://example.org/path/to/res?edit=1 we can have:

    Protocol relative form
    -
    @@ -121,7 +121,7 @@ http://www.gnu.org/software/src-highlite --> cowboy_req:uri(Req, #{scheme => undefined}).
    Serialized origin for use in the origin header
    -
    @@ -129,7 +129,7 @@ http://www.gnu.org/software/src-highlite --> cowboy_req:uri(Req, #{path => undefined, qs => undefined}).
    HTTP/1.1 origin form (path and query string only)
    -
    @@ -137,7 +137,7 @@ http://www.gnu.org/software/src-highlite --> cowboy_req:uri(Req, #{host => undefined}).
    Add a fragment to the URI
    -
    @@ -145,7 +145,7 @@ http://www.gnu.org/software/src-highlite --> cowboy_req:uri(Req, #{fragment => <<"errors">>}).
    Ensure the scheme is HTTPS
    -
    @@ -153,7 +153,7 @@ http://www.gnu.org/software/src-highlite --> cowboy_req:uri(Req, #{scheme => <<"https">>}).
    Convert the URI to a binary string
    -
    @@ -196,6 +196,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req.version/index.html b/docs/en/cowboy/2.5/manual/cowboy_req.version/index.html index bd32b20a..cbd97ab9 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req.version/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req.version/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_req:version - HTTP version

    Description

    -
    @@ -73,7 +73,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the HTTP version used for the request.

    The version can also be obtained using pattern matching:

    -
    @@ -94,7 +94,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Get the HTTP version
    -
    @@ -137,6 +137,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_req/index.html b/docs/en/cowboy/2.5/manual/cowboy_req/index.html index 99373d52..54ceccfb 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_req/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_req/index.html @@ -193,7 +193,7 @@

    Types

    push_opts()

    -
    @@ -208,7 +208,7 @@ http://www.gnu.org/software/src-highlite -->

    Push options.

    By default, Cowboy will use the GET method, an empty query string, and take the scheme, host and port directly from the current request's URI.

    read_body_opts()

    -
    @@ -221,7 +221,7 @@ http://www.gnu.org/software/src-highlite -->

    Body reading options.

    The defaults are function-specific.

    req()

    -
    @@ -243,14 +243,14 @@ http://www.gnu.org/software/src-highlite -->

    Contains information about the request and response. While some fields are publicly documented, others aren't and shouldn't be used.

    You may add custom fields if required. Make sure to namespace them by prepending an underscore and the name of your application:

    Setting a custom field
    -
    Req#{_myapp_auth_method => pubkey}.

    resp_body()

    -
    @@ -265,7 +265,7 @@ http://www.gnu.org/software/src-highlite -->

    It can take two forms: the actual data to be sent or a tuple indicating which file to send.

    When sending data directly, the type is either a binary or an iolist. Iolists are an efficient way to build output. Instead of concatenating strings or binaries, you can simply build a list containing the fragments you want to send in the order they should be sent:

    Example iolists usage
    -
    @@ -312,6 +312,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_rest/index.html b/docs/en/cowboy/2.5/manual/cowboy_rest/index.html index 969369ec..3797618d 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_rest/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_rest/index.html @@ -69,7 +69,7 @@

    Implementing REST handlers is not enough to provide a REST interface; this interface must also follow the REST constraints including HATEOAS (hypermedia as the engine of application state).

    Callbacks

    REST handlers implement the following interface:

    -
    @@ -110,7 +110,7 @@ http://www.gnu.org/software/src-highlite -->

    REST callbacks

    AcceptCallback

    -
    @@ -126,7 +126,7 @@ http://www.gnu.org/software/src-highlite -->

    For PATCH requests, the body is a series of instructions on how to update the resource. Patch files or JSON Patch are examples of such media types.

    A response body may be sent. The appropriate media type, charset and language for the response can be retrieved from the Req object using the media_type, charset and language keys, respectively. The body can be set using cowboy_req:set_resp_body(3).

    allowed_methods

    -
    @@ -137,7 +137,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the list of allowed methods.

    allow_missing_post

    -
    @@ -149,7 +149,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether POST is allowed when the resource doesn't exist.

    Returning true here means that a new resource will be created. The URI for the newly created resource should be returned from the AcceptCallback function.

    charsets_provided

    -
    @@ -162,7 +162,7 @@ http://www.gnu.org/software/src-highlite -->

    During content negotiation Cowboy will pick the most appropriate charset for the client. The client advertises charsets it prefers with the accept-charset header. When that header is missing, Cowboy picks the first charset from the resource.

    Cowboy will add the negotiated charset to the Req object after this step completes:

    -
    @@ -171,7 +171,7 @@ http://www.gnu.org/software/src-highlite --> }

    content_types_accepted

    -
    @@ -200,7 +200,7 @@ http://www.gnu.org/software/src-highlite -->

    content_types_provided

    -
    @@ -225,7 +225,7 @@ http://www.gnu.org/software/src-highlite -->

    An empty parameters list [] means that no parameters will be accepted. When any parameter is acceptable, the tuple form should be used with parameters as the atom '*'.

    Cowboy treats all parameters as case sensitive, except for the charset parameter, which is known to be case insensitive. You should therefore always provide the charset as a lowercase binary string.

    Cowboy will add the negotiated media_type to the Req object after this step completes:

    -
    @@ -235,7 +235,7 @@ http://www.gnu.org/software/src-highlite -->

    delete_completed

    -
    @@ -247,7 +247,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether the resource has been fully deleted from the system, including from any internal cache.

    Returning false will result in a 202 Accepted response being sent instead of a 200 OK or 204 No Content.

    delete_resource

    -
    @@ -259,7 +259,7 @@ http://www.gnu.org/software/src-highlite -->

    Delete the resource.

    Cowboy will send an error response when this function returns false.

    expires

    -
    @@ -270,7 +270,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the resource's expiration date.

    forbidden

    -
    @@ -282,7 +282,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether access to the resource is forbidden.

    A 403 Forbidden response will be sent if this function returns true. This status code means that access is forbidden regardless of authentication, and that the request shouldn't be repeated.

    generate_etag

    -
    @@ -294,7 +294,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the entity tag of the resource.

    When a binary is returned, the value is automatically parsed to a tuple. The binary must be in the same format as the etag header, including quotes.

    is_authorized

    -
    @@ -307,7 +307,7 @@ http://www.gnu.org/software/src-highlite -->

    This function should be used to perform any necessary authentication of the user before attempting to perform any action on the resource.

    When authentication fails, the AuthHeader value will be sent in the www-authenticate header for the 401 Unauthorized response.

    is_conflict

    -
    @@ -319,7 +319,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether the PUT request results in a conflict.

    A 409 Conflict response is sent when true.

    known_methods

    -
    @@ -333,7 +333,7 @@ http://www.gnu.org/software/src-highlite -->

    The full list of methods known by the server should be returned, regardless of their use in the resource.

    The default value lists the methods Cowboy knows and implement in cowboy_rest.

    languages_provided

    -
    @@ -346,7 +346,7 @@ http://www.gnu.org/software/src-highlite -->

    During content negotiation Cowboy will pick the most appropriate language for the client. The client advertises languages it prefers with the accept-language header. When that header is missing, Cowboy picks the first language from the resource.

    Cowboy will add the negotiated language to the Req object after this step completes:

    -
    @@ -355,7 +355,7 @@ http://www.gnu.org/software/src-highlite --> }

    last_modified

    -
    @@ -367,7 +367,7 @@ http://www.gnu.org/software/src-highlite -->

    Return the resource's last modification date.

    This date will be used to test against the if-modified-since and if-unmodified-since headers, and sent as the last-modified header in the response to GET and HEAD requests.

    malformed_request

    -
    @@ -379,7 +379,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether the request is malformed.

    A request is malformed when a component required by the resource is invalid. This may include the query string or individual headers. They should be parsed and validated in this function. The body should not be read at this point.

    moved_permanently

    -
    @@ -390,7 +390,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether the resource was permanently moved, and what its new location is.

    moved_temporarily

    -
    @@ -401,7 +401,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether the resource was temporarily moved, and what its new location is.

    multiple_choices

    -
    @@ -414,7 +414,7 @@ http://www.gnu.org/software/src-highlite -->

    Return true when the server has multiple representations of a resource, each with their specific identifier, but is unable to determine which is best for the client. For example an image might have different sizes and the server is unable to determine the capabilities of the client.

    When returning true the server should send a body with links to the different representations. If the server has a preferred representation it can send its link inside a location header.

    options

    -
    @@ -423,7 +423,7 @@ http://www.gnu.org/software/src-highlite -->

    Respond to an OPTIONS request.

    The response should inform the client the communication options available for this resource. By default Cowboy will send a 200 OK response with the allow header set.

    previously_existed

    -
    @@ -434,7 +434,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether the resource existed previously.

    ProvideCallback

    -
    @@ -452,7 +452,7 @@ http://www.gnu.org/software/src-highlite -->

    Note that there used to be a way to stream the response body. It was temporarily removed and will be added back in a later release.

    resource_exists

    -
    @@ -463,7 +463,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether the resource exists.

    service_available

    -
    @@ -475,7 +475,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether the service is available.

    A 503 Service Unavailable response will be sent when this function returns false.

    uri_too_long

    -
    @@ -487,7 +487,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether the requested URI is too long.

    This function can be used to further restrict the length of the URI for this specific resource.

    valid_content_headers

    -
    @@ -499,7 +499,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether the content headers are valid.

    This callback can be used to reject requests that have invalid content header values, for example an unsupported content-encoding.

    valid_entity_length

    -
    @@ -511,7 +511,7 @@ http://www.gnu.org/software/src-highlite -->

    Return whether the request body length is within acceptable boundaries.

    A 413 Request Entity Too Large response will be sent if this function returns false.

    variances

    -
    @@ -565,6 +565,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_router.compile/index.html b/docs/en/cowboy/2.5/manual/cowboy_router.compile/index.html index 835c36e1..289fdb48 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_router.compile/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_router.compile/index.html @@ -65,7 +65,7 @@

    Name

    cowboy_router:compile - Compile routes to the resources

    Description

    -
    @@ -86,7 +86,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Compile routes and start a listener
    -
    @@ -138,6 +138,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_router/index.html b/docs/en/cowboy/2.5/manual/cowboy_router/index.html index 4d038b17..0bd90840 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_router/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_router/index.html @@ -75,7 +75,7 @@

    Types

    bindings()

    -
    @@ -85,7 +85,7 @@ http://www.gnu.org/software/src-highlite -->

    dispatch_rules()

    Opaque type containing the compiled routes.

    routes()

    -
    @@ -111,7 +111,7 @@ http://www.gnu.org/software/src-highlite -->

    tokens()

    -
    @@ -155,6 +155,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_static/index.html b/docs/en/cowboy/2.5/manual/cowboy_static/index.html index 5939ab08..5fe7482a 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_static/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_static/index.html @@ -68,7 +68,7 @@

    The module cowboy_static implements file serving capabilities using the REST semantics provided by cowboy_rest.

    The static file handler is a pre-written handler coming with Cowboy. To serve files, use it in your routes.

    Options

    -
    @@ -114,7 +114,7 @@ http://www.gnu.org/software/src-highlite -->

    The extra options allow you to define how the etag should be calculated and how the MIME type of files should be detected.

    By default the static handler will generate an etag based on the size and modification time of the file. You may disable the etag entirely with {etag, false} or provide a module and function that will be called when needed:

    -
    @@ -125,7 +125,7 @@ http://www.gnu.org/software/src-highlite --> Mtime :: file:date_time()

    By default the static handler will detect Web-related MIME types by looking at the file extension. You can provide a specific MIME type that will always be used, or a module and function that will be called when needed:

    -
    @@ -144,7 +144,7 @@ http://www.gnu.org/software/src-highlite -->

    Examples

    Custom etag function
    -
    @@ -153,7 +153,7 @@ http://www.gnu.org/software/src-highlite --> erlang:phash2({Path, Size, Mtime}, 16#ffffffff))}.
    Custom MIME type function
    -
    @@ -200,6 +200,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_stream/index.html b/docs/en/cowboy/2.5/manual/cowboy_stream/index.html index 35ccac93..da43f4b2 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_stream/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_stream/index.html @@ -71,7 +71,7 @@

    Extra care must be taken when implementing stream handlers to ensure compatibility. While some modification of the events and commands is allowed, it is generally not a good idea to completely omit them.

    Callbacks

    Stream handlers must implement the following interface:

    -
    @@ -105,7 +105,7 @@ http://www.gnu.org/software/src-highlite -->

    The following commands are defined:

    inform

    Send an informational response to the client.

    -
    @@ -114,7 +114,7 @@ http://www.gnu.org/software/src-highlite -->

    Any number of informational responses may be sent, but only until the final response is sent.

    response

    Send a response to the client.

    -
    @@ -124,7 +124,7 @@ http://www.gnu.org/software/src-highlite -->

    No more data can be sent after this command.

    headers

    Initiate a response to the client.

    -
    @@ -133,7 +133,7 @@ http://www.gnu.org/software/src-highlite -->

    This initiates a response to the client. The stream will end when a data command with the fin flag or a trailer command is returned.

    data

    Send data to the client.

    -
    @@ -141,7 +141,7 @@ http://www.gnu.org/software/src-highlite -->

    trailers

    Send response trailers to the client.

    -
    @@ -149,7 +149,7 @@ http://www.gnu.org/software/src-highlite -->

    push

    Push a resource to the client.

    -
    @@ -160,7 +160,7 @@ http://www.gnu.org/software/src-highlite -->

    The command will be ignored if the protocol does not provide any server push mechanism.

    flow

    -
    @@ -169,7 +169,7 @@ http://www.gnu.org/software/src-highlite -->

    Request more data to be read from the request body. The exact behavior depends on the protocol.

    spawn

    Inform Cowboy that a process was spawned and should be supervised.

    -
    @@ -177,7 +177,7 @@ http://www.gnu.org/software/src-highlite -->

    error_response

    Send an error response if no response was sent previously.

    -
    @@ -185,7 +185,7 @@ http://www.gnu.org/software/src-highlite -->

    switch_protocol

    Switch to a different protocol.

    -
    @@ -195,7 +195,7 @@ http://www.gnu.org/software/src-highlite -->

    Note that the 101 informational response will not be sent after a final response.

    stop

    Stop the stream.

    -
    @@ -206,7 +206,7 @@ http://www.gnu.org/software/src-highlite -->

    To indicate that an error occurred, either use error_response before stopping, or use internal_error.

    internal_error

    Stop the stream with an error.

    -
    @@ -224,7 +224,7 @@ http://www.gnu.org/software/src-highlite -->

    A process spawned by this stream has exited.

    -
    @@ -273,7 +273,7 @@ http://www.gnu.org/software/src-highlite -->

    Types

    commands()

    -
    @@ -281,7 +281,7 @@ http://www.gnu.org/software/src-highlite -->

    See the list of commands for details.

    fin()

    -
    @@ -289,7 +289,7 @@ http://www.gnu.org/software/src-highlite -->

    Used in commands and events to indicate that this is the end of the stream.

    partial_req()

    -
    @@ -307,7 +307,7 @@ http://www.gnu.org/software/src-highlite -->

    Partial request information received when an early error is detected.

    reason()

    -
    @@ -323,7 +323,7 @@ http://www.gnu.org/software/src-highlite -->

    Reason for the stream termination.

    resp_command()

    -
    @@ -332,7 +332,7 @@ http://www.gnu.org/software/src-highlite -->

    See the response command for details.

    streamid()

    -
    @@ -383,6 +383,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/cowboy_websocket/index.html b/docs/en/cowboy/2.5/manual/cowboy_websocket/index.html index 281162d0..47993e28 100644 --- a/docs/en/cowboy/2.5/manual/cowboy_websocket/index.html +++ b/docs/en/cowboy/2.5/manual/cowboy_websocket/index.html @@ -68,7 +68,7 @@

    The module cowboy_websocket implements Websocket as a Ranch protocol. It also defines a callback interface for handling Websocket connections.

    Callbacks

    Websocket handlers must implement the following callback interface:

    -
    @@ -143,7 +143,7 @@ http://www.gnu.org/software/src-highlite -->

    Types

    cow_ws:frame()

    -
    @@ -158,7 +158,7 @@ http://www.gnu.org/software/src-highlite -->

    Websocket frames that can be sent as a response.

    Note that there is no need to send pong frames back as Cowboy does it automatically for you.

    opts()

    -
    @@ -171,7 +171,7 @@ http://www.gnu.org/software/src-highlite -->

    Websocket handler options.

    This configuration is passed to Cowboy from the init/2 function:

    -
    @@ -238,6 +238,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/http_status_codes/index.html b/docs/en/cowboy/2.5/manual/http_status_codes/index.html index dd944448..d3eba829 100644 --- a/docs/en/cowboy/2.5/manual/http_status_codes/index.html +++ b/docs/en/cowboy/2.5/manual/http_status_codes/index.html @@ -182,6 +182,8 @@ +
  • 2.7
  • +
  • 2.6
  • 2.5
  • diff --git a/docs/en/cowboy/2.5/manual/index.html b/docs/en/cowboy/2.5/manual/index.html index 23fe3237..402fef41 100644 --- a/docs/en/cowboy/2.5/manual/index.html +++ b/docs/en/cowboy/2.5/manual/index.html @@ -122,7 +122,7 @@

    All these applications must be started before the cowboy application. To start Cowboy and all dependencies at once:

    -
    @@ -167,6 +167,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.7
  • +
  • 2.6
  • 2.5
  • -- cgit v1.2.3