diff options
author | Loïc Hoguin <[email protected]> | 2018-04-04 13:13:37 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-04-04 13:13:37 +0200 |
commit | d2a3f2cedd7c00d0933222aed9c06b3149aa4db4 (patch) | |
tree | 4f1499bac639c782b250af0fbf0dec2064315813 /docs/en/cowboy/2.0/guide | |
parent | 1d654719f5fa6be67d2c95145872068665702cb7 (diff) | |
download | ninenines.eu-d2a3f2cedd7c00d0933222aed9c06b3149aa4db4.tar.gz ninenines.eu-d2a3f2cedd7c00d0933222aed9c06b3149aa4db4.tar.bz2 ninenines.eu-d2a3f2cedd7c00d0933222aed9c06b3149aa4db4.zip |
Cowboy 2.3.0
Diffstat (limited to 'docs/en/cowboy/2.0/guide')
27 files changed, 215 insertions, 161 deletions
diff --git a/docs/en/cowboy/2.0/guide/constraints/index.html b/docs/en/cowboy/2.0/guide/constraints/index.html index f3b9e3e1..afc44831 100644 --- a/docs/en/cowboy/2.0/guide/constraints/index.html +++ b/docs/en/cowboy/2.0/guide/constraints/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Constraints</title> @@ -94,7 +94,7 @@ then the next one receives the new value.</p></div> and convert the field <code>my_value</code> to an integer, and then check that the integer is positive:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -110,7 +110,7 @@ We will simply learn what it is later in this chapter.</p></div> <div class="paragraph"><p>When there’s only one constraint, it can be provided directly without wrapping it into a list:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -159,7 +159,7 @@ value is and what must be returned depends on the operation.</p></div> used for validating and converting user input is the <code>forward</code> operation.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -175,7 +175,7 @@ by the constraint.</p></div> takes a converted value and changes it back to what the user input would have been.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -189,7 +189,7 @@ http://www.gnu.org/software/src-highlite --> returned by any other operation and returns a formatted human-readable error message.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -258,6 +258,8 @@ functions. They should be written to not emit any exceptions.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/cookies/index.html b/docs/en/cowboy/2.0/guide/cookies/index.html index dc0adfd7..c62e9017 100644 --- a/docs/en/cowboy/2.0/guide/cookies/index.html +++ b/docs/en/cowboy/2.0/guide/cookies/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Using cookies</title> @@ -95,7 +95,7 @@ update the expiration time and avoid losing a cookie.</p></div> <div class="sectionbody"> <div class="paragraph"><p>By default cookies are defined for the duration of the session:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -103,7 +103,7 @@ http://www.gnu.org/software/src-highlite --> <span style="color: #009900">Req</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:set_resp_cookie</span></span>(<span style="color: #990000"><<</span><span style="color: #FF0000">"sessionid"</span><span style="color: #990000">>></span>, <span style="color: #009900">SessionID</span>, <span style="color: #009900">Req0</span>)<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>They can also be set for a duration in seconds:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -112,7 +112,7 @@ http://www.gnu.org/software/src-highlite --> #{<span style="color: #0000FF">max_age</span> <span style="color: #990000">=></span> <span style="color: #993399">3600</span>})<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>To delete cookies, set <code>max_age</code> to 0:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -122,7 +122,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>To restrict cookies to a specific domain and path, the options of the same name can be used:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -134,7 +134,7 @@ in the path hierarchy.</p></div> <div class="paragraph"><p>To restrict cookies to secure channels (typically resources available over HTTPS):</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -143,7 +143,7 @@ http://www.gnu.org/software/src-highlite --> #{<span style="color: #0000FF">secure</span> <span style="color: #990000">=></span> <span style="color: #000080">true</span>})<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>To prevent client-side scripts from accessing a cookie:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -164,7 +164,7 @@ involve parsing the cookie header(s) and so should not be called repeatedly.</p></div> <div class="paragraph"><p>You can get all cookies as a key/value list:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -175,7 +175,7 @@ only the ones you need, while at the same time doing any required post processing using <a href="../constraints">constraints</a>. This function returns a map:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -185,7 +185,7 @@ them. The following snippet will crash if the <code>id</code> cookie is not an integer number or if the <code>lang</code> cookie is empty. Additionally the <code>id</code> cookie value will be converted to an integer term:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -196,7 +196,7 @@ will be a list of the two cookie values.</p></div> if the <code>lang</code> cookie is not found. It will not be used if the cookie is found but has an empty value:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -261,6 +261,8 @@ exception is thrown.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/erlang_web/index.html b/docs/en/cowboy/2.0/guide/erlang_web/index.html index af873d5e..c607b9e1 100644 --- a/docs/en/cowboy/2.0/guide/erlang_web/index.html +++ b/docs/en/cowboy/2.0/guide/erlang_web/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Erlang and the Web</title> @@ -311,6 +311,8 @@ ebook version.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/flow_diagram/index.html b/docs/en/cowboy/2.0/guide/flow_diagram/index.html index c891a623..567fd4ca 100644 --- a/docs/en/cowboy/2.0/guide/flow_diagram/index.html +++ b/docs/en/cowboy/2.0/guide/flow_diagram/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Flow diagram</title> @@ -230,6 +230,8 @@ be the cause.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/getting_started/index.html b/docs/en/cowboy/2.0/guide/getting_started/index.html index 511484d9..b0f7b404 100644 --- a/docs/en/cowboy/2.0/guide/getting_started/index.html +++ b/docs/en/cowboy/2.0/guide/getting_started/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Getting started</title> @@ -91,7 +91,7 @@ to get your environment setup before you continue.</p></div> <div class="sectionbody"> <div class="paragraph"><p>First, let’s create the directory for our application.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -100,7 +100,7 @@ $ cd hello_erlang</tt></pre></div></div> <div class="paragraph"><p>Then we need to download Erlang.mk. Either use the following command or download it manually.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -108,7 +108,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>We can now bootstrap our application. Since we are going to generate a release, we will also bootstrap it at the same time.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -117,7 +117,7 @@ http://www.gnu.org/software/src-highlite --> necessary for creating the release. We can already build and start this release.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -138,7 +138,7 @@ handler.</p></div> <div class="paragraph"><p>We will modify the <em>Makefile</em> to tell the build system it needs to fetch and compile Cowboy:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -167,7 +167,7 @@ done at application startup.</p></div> <div class="paragraph"><p>Open the <em>src/hello_erlang_app.erl</em> file and add the necessary code to the <code>start/2</code> function to make it look like this:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -197,7 +197,7 @@ and Websocket handlers. For this tutorial we will use a plain HTTP handler.</p></div> <div class="paragraph"><p>Generate a handler from a template:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -205,7 +205,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>Then, open the <em>src/hello_handler.erl</em> file and modify the <code>init/2</code> function like this to send a reply.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -278,6 +278,8 @@ in your browser, you should get a nice <code>Hello Erlang!</code> displayed!</p> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/handlers/index.html b/docs/en/cowboy/2.0/guide/handlers/index.html index 89218952..397035c2 100644 --- a/docs/en/cowboy/2.0/guide/handlers/index.html +++ b/docs/en/cowboy/2.0/guide/handlers/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Handlers</title> @@ -78,7 +78,7 @@ sends a response and then returns.</p></div> state defined in the <a href="../routing">router configuration</a>.</p></div> <div class="paragraph"><p>A handler that does nothing would look like this:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -89,7 +89,7 @@ sent to the client, as Cowboy makes sure that a response is sent for every request.</p></div> <div class="paragraph"><p>We need to use the Req object to reply.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -123,7 +123,7 @@ can define your own handler types.</p></div> return the name of the handler type you want to use. The following snippet switches to a Websocket handler:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -136,7 +136,7 @@ http://www.gnu.org/software/src-highlite --> <div class="sectionbody"> <div class="paragraph"><p>All handler types provide the optional <code>terminate/3</code> callback.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -208,6 +208,8 @@ process will terminate soon after this call returns.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/index.html b/docs/en/cowboy/2.0/guide/index.html index c10c7d5f..8226f7cd 100644 --- a/docs/en/cowboy/2.0/guide/index.html +++ b/docs/en/cowboy/2.0/guide/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Cowboy User Guide</title> @@ -294,6 +294,8 @@ + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/introduction/index.html b/docs/en/cowboy/2.0/guide/introduction/index.html index a6b83502..e170569f 100644 --- a/docs/en/cowboy/2.0/guide/introduction/index.html +++ b/docs/en/cowboy/2.0/guide/introduction/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Introduction</title> @@ -196,6 +196,8 @@ when sending responses.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/listeners/index.html b/docs/en/cowboy/2.0/guide/listeners/index.html index 2a79dd4c..071dbe6d 100644 --- a/docs/en/cowboy/2.0/guide/listeners/index.html +++ b/docs/en/cowboy/2.0/guide/listeners/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Listeners</title> @@ -88,7 +88,7 @@ however so a common alternative is port 8080.</p></div> <div class="paragraph"><p>The following snippet starts listening for connections on port 8080:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -128,7 +128,7 @@ 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.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -226,6 +226,8 @@ shared.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/loop_handlers/index.html b/docs/en/cowboy/2.0/guide/loop_handlers/index.html index eb0a0caf..fcf0450d 100644 --- a/docs/en/cowboy/2.0/guide/loop_handlers/index.html +++ b/docs/en/cowboy/2.0/guide/loop_handlers/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Loop handlers</title> @@ -95,7 +95,7 @@ a timeout value and/or the atom <code>hibernate</code> to make the process enter hibernation until a message is received.</p></div> <div class="paragraph"><p>This snippet enables the loop handler:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -103,7 +103,7 @@ http://www.gnu.org/software/src-highlite --> {<span style="color: #FF6600">cowboy_loop</span>, <span style="color: #009900">Req</span>, <span style="color: #009900">State</span>}<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>This also makes the process hibernate:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -122,7 +122,7 @@ and the handler’s state.</p></div> <code>reply</code> message from another process, or waits for another message otherwise.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -155,7 +155,7 @@ every time a message is received.</p></div> a chunk is sent every time an <code>event</code> message is received, and the loop is stopped by sending an <code>eof</code> message.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -248,6 +248,8 @@ accordingly.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/middlewares/index.html b/docs/en/cowboy/2.0/guide/middlewares/index.html index f764a1cb..b3312263 100644 --- a/docs/en/cowboy/2.0/guide/middlewares/index.html +++ b/docs/en/cowboy/2.0/guide/middlewares/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Middlewares</title> @@ -209,6 +209,8 @@ values. It puts the result of the request handling into <code>result</code>.</p> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/migrating_from_1.0/index.html b/docs/en/cowboy/2.0/guide/migrating_from_1.0/index.html index 75e3ffd1..d85a06e7 100644 --- a/docs/en/cowboy/2.0/guide/migrating_from_1.0/index.html +++ b/docs/en/cowboy/2.0/guide/migrating_from_1.0/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Migrating from Cowboy 1.0 to 2.0</title> @@ -495,6 +495,8 @@ The static file handler has been improved to handle more special + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/modern_web/index.html b/docs/en/cowboy/2.0/guide/modern_web/index.html index 9b30ce92..3b51efe1 100644 --- a/docs/en/cowboy/2.0/guide/modern_web/index.html +++ b/docs/en/cowboy/2.0/guide/modern_web/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: The modern Web</title> @@ -228,6 +228,8 @@ the HTTP protocol.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/multipart/index.html b/docs/en/cowboy/2.0/guide/multipart/index.html index 74ce4800..a290b34f 100644 --- a/docs/en/cowboy/2.0/guide/multipart/index.html +++ b/docs/en/cowboy/2.0/guide/multipart/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Multipart requests</title> @@ -108,7 +108,7 @@ Proper investigation of the contents is recommended.</p></div> <div class="paragraph"><p>The content-type header indicates the presence of a multipart message:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -129,7 +129,7 @@ need to call the function multiple times.</p></div> <div class="paragraph"><p>To read a multipart message you need to iterate over all its parts:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -153,7 +153,7 @@ is a normal field or a file being uploaded.</p></div> use different strategies depending on whether the part is a file:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -186,14 +186,14 @@ up to 64KB for up to 5 seconds. <code>cowboy_req:read_part_body/1</code> has the same defaults as <code>cowboy_req:read_body/1</code>.</p></div> <div class="paragraph"><p>To change the defaults for part headers:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> <pre><tt><span style="font-weight: bold"><span style="color: #000000">cowboy_req:read_part</span></span>(<span style="color: #009900">Req</span>, #{<span style="font-weight: bold"><span style="color: #000080">length</span></span> <span style="color: #990000">=></span> <span style="color: #993399">128000</span>})<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>And for part bodies:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -208,7 +208,7 @@ skip it when you request the next part’s body.</p></div> <div class="paragraph"><p>The following snippet reads all part headers and skips all bodies:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -286,6 +286,8 @@ reading as soon as you find the data you need.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/req/index.html b/docs/en/cowboy/2.0/guide/req/index.html index 1b81cdfc..d6f7a2fd 100644 --- a/docs/en/cowboy/2.0/guide/req/index.html +++ b/docs/en/cowboy/2.0/guide/req/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: The Req object</title> @@ -91,7 +91,7 @@ head. The following example sends a simple "Hello world!" response when the <code>method</code> is GET, and a 405 error otherwise.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -146,14 +146,14 @@ where the crash occurred.</p></div> <div class="sectionbody"> <div class="paragraph"><p>The request method can be retrieved directly:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> <pre><tt>#{<span style="color: #FF6600">method</span> <span style="color: #990000">:=</span> <span style="color: #009900">Method</span>} <span style="color: #990000">=</span> <span style="color: #009900">Req</span><span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>Or using a function:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -175,14 +175,14 @@ want to redirect HTTP/1.1 clients to use Websocket, while HTTP/2 clients keep using HTTP/2.</p></div> <div class="paragraph"><p>The HTTP version can be retrieved directly:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> <pre><tt>#{<span style="color: #FF6600">version</span> <span style="color: #990000">:=</span> <span style="color: #009900">Version</span>} <span style="color: #990000">=</span> <span style="color: #009900">Req</span><span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>Or using a function:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -198,7 +198,7 @@ atoms.</p></div> <div class="paragraph"><p>The scheme, host, port, path and query string components of the effective request URI can all be retrieved directly:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -211,7 +211,7 @@ http://www.gnu.org/software/src-highlite --> } <span style="color: #990000">=</span> <span style="color: #009900">Req</span><span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>Or using the related functions:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -230,7 +230,7 @@ for requests on secure HTTP/1.1 or HTTP/2 connections.</p></div> the <code>cowboy_req:uri/1,2</code> function. By default, an absolute URI is returned:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -240,7 +240,7 @@ http://www.gnu.org/software/src-highlite --> or all of the components. Various URIs or URI formats can be generated this way, including the origin form:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -248,7 +248,7 @@ http://www.gnu.org/software/src-highlite --> <span style="color: #009900">URI</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:uri</span></span>(<span style="color: #009900">Req</span>, #{<span style="color: #0000FF">host</span> <span style="color: #990000">=></span> <span style="color: #000080">undefined</span>})<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>The protocol relative form:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -256,14 +256,14 @@ http://www.gnu.org/software/src-highlite --> <span style="color: #009900">URI</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:uri</span></span>(<span style="color: #009900">Req</span>, #{<span style="color: #0000FF">scheme</span> <span style="color: #990000">=></span> <span style="color: #000080">undefined</span>})<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>The absolute URI without a query string:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> <pre><tt><span style="color: #009900">URI</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:uri</span></span>(<span style="color: #009900">Req</span>, #{<span style="color: #0000FF">qs</span> <span style="color: #990000">=></span> <span style="color: #000080">undefined</span>})<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>A different host:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -280,7 +280,7 @@ They are only available after the routing.</p></div> <div class="paragraph"><p>Cowboy provides functions to retrieve one or all bindings.</p></div> <div class="paragraph"><p>To retrieve a single value:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -289,14 +289,14 @@ http://www.gnu.org/software/src-highlite --> <code>undefined</code> will be returned. A different default value can be provided:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> <pre><tt><span style="color: #009900">Value</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:binding</span></span>(<span style="color: #FF6600">userid</span>, <span style="color: #009900">Req</span>, <span style="color: #993399">42</span>)<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>To retrieve everything that was bound:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -306,14 +306,14 @@ http://www.gnu.org/software/src-highlite --> or path segments at once using the <code>...</code> qualifier.</p></div> <div class="paragraph"><p>To retrieve the segments captured from the host name:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> <pre><tt><span style="color: #009900">HostInfo</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:host_info</span></span>(<span style="color: #009900">Req</span>)<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>And the path segments:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -328,7 +328,7 @@ in the route.</p></div> <div class="paragraph"><p>Cowboy provides two functions to access query parameters. You can use the first to get the entire list of parameters.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -351,7 +351,7 @@ only the parameters you are interested in, and at the same time do any post processing you require using <a href="../constraints">constraints</a>. This function returns a map.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -361,7 +361,7 @@ snippet will crash when the <code>id</code> parameter is not an integer, or when the <code>lang</code> parameter is empty. At the same time, the value for <code>id</code> will be converted to an integer term:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -370,7 +370,7 @@ http://www.gnu.org/software/src-highlite --> if the <code>lang</code> key is not found. It will not be used if the key is found but has an empty value.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -390,7 +390,7 @@ ensure that only one value was passed through.</p></div> or parsed into a more meaningful representation.</p></div> <div class="paragraph"><p>The get the raw value:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -401,21 +401,21 @@ regardless of the underlying protocol.</p></div> <div class="paragraph"><p>When the header is missing from the request, <code>undefined</code> will be returned. A different default can be provided:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> <pre><tt><span style="color: #009900">HeaderVal</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:header</span></span>(<span style="color: #990000"><<</span><span style="color: #FF0000">"content-type"</span><span style="color: #990000">>></span>, <span style="color: #009900">Req</span>, <span style="color: #990000"><<</span><span style="color: #FF0000">"text/plain"</span><span style="color: #990000">>></span>)<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>All headers can be retrieved at once, either directly:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> <pre><tt>#{<span style="color: #FF6600">headers</span> <span style="color: #990000">:=</span> <span style="color: #009900">AllHeaders</span>} <span style="color: #990000">=</span> <span style="color: #009900">Req</span><span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>Or using a function:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -424,7 +424,7 @@ http://www.gnu.org/software/src-highlite --> headers. There is no function to parse all headers at once.</p></div> <div class="paragraph"><p>To parse a specific header:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -436,7 +436,7 @@ and default values can be found in the manual.</p></div> change the default value. Note that it should be the parsed value directly:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -451,14 +451,14 @@ http://www.gnu.org/software/src-highlite --> retrieved either directly or using a function.</p></div> <div class="paragraph"><p>To retrieve the peer directly:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> <pre><tt>#{<span style="color: #FF6600">peer</span> <span style="color: #990000">:=</span> {<span style="color: #009900">IP</span>, <span style="color: #009900">Port</span>}} <span style="color: #990000">=</span> <span style="color: #009900">Req</span><span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>And using a function:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -524,6 +524,8 @@ client itself. It may also be a proxy or a gateway.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/req_body/index.html b/docs/en/cowboy/2.0/guide/req_body/index.html index f9e056c9..38056650 100644 --- a/docs/en/cowboy/2.0/guide/req_body/index.html +++ b/docs/en/cowboy/2.0/guide/req_body/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Reading the request body</title> @@ -85,7 +85,7 @@ The latter is covered in its own chapter.</p></div> <div class="paragraph"><p>Not all requests come with a body. You can check for the presence of a request body with this function:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -102,7 +102,7 @@ just attempt to read it directly.</p></div> <div class="sectionbody"> <div class="paragraph"><p>You can obtain the length of the body:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -122,7 +122,7 @@ after reading the body completely.</p></div> <div class="sectionbody"> <div class="paragraph"><p>You can read the entire body with one function call:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -136,7 +136,7 @@ the end of the 15 seconds period.</p></div> <div class="paragraph"><p>These values can be customized. For example, to read only up to 1MB for up to 5 seconds:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -144,7 +144,7 @@ http://www.gnu.org/software/src-highlite --> #{<span style="font-weight: bold"><span style="color: #000080">length</span></span> <span style="color: #990000">=></span> <span style="color: #993399">1000000</span>, <span style="color: #0000FF">period</span> <span style="color: #990000">=></span> <span style="color: #993399">5000</span>})<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>You may also disable the length limit:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -164,7 +164,7 @@ a <code>more</code> tuple instead of <code>ok</code>. You can call the function again to read more of the body, reading it one chunk at a time.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -187,7 +187,7 @@ They need to be passed for every call.</p></div> <div class="paragraph"><p>Cowboy provides a convenient function for reading and parsing bodies sent as application/x-www-form-urlencoded.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -197,7 +197,7 @@ the function <code>cowboy_req:parse_qs/1</code>.</p></div> <div class="paragraph"><p>The defaults for this function are different. Cowboy will read for up to 64KB and up to 5 seconds. They can be modified:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -261,6 +261,8 @@ http://www.gnu.org/software/src-highlite --> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/resource_design/index.html b/docs/en/cowboy/2.0/guide/resource_design/index.html index 11e06315..efcfed82 100644 --- a/docs/en/cowboy/2.0/guide/resource_design/index.html +++ b/docs/en/cowboy/2.0/guide/resource_design/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Designing a resource handler</title> @@ -330,6 +330,8 @@ no way of knowing it has been completed yet, implement the + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/resp/index.html b/docs/en/cowboy/2.0/guide/resp/index.html index e555fe38..53db6025 100644 --- a/docs/en/cowboy/2.0/guide/resp/index.html +++ b/docs/en/cowboy/2.0/guide/resp/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Sending a response</title> @@ -90,7 +90,7 @@ cases, Cowboy will add any headers required by the protocol <div class="paragraph"><p>When you need to set only the status code, use <code>cowboy_req:reply/2</code>:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -98,7 +98,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>When you need to set response headers at the same time, use <code>cowboy_req:reply/3</code>:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -110,7 +110,7 @@ binary.</p></div> <div class="paragraph"><p>When you also need to set the response body, use <code>cowboy_req:reply/4</code>:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -126,7 +126,7 @@ binaries, characters, strings or other iolists. This allows you to build a response from different parts without having to do any concatenation:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -151,7 +151,7 @@ Cowboy will add any required headers to the response.</p></div> <div class="paragraph"><p>When you need to set only the status code, use <code>cowboy_req:stream_reply/2</code>:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -168,7 +168,7 @@ not recommended. All responses with a body should have a content-type. The header can be set beforehand, or using the <code>cowboy_req:stream_reply/3</code>:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -197,7 +197,7 @@ and sent as part of the response when a reply function is called.</p></div> <div class="paragraph"><p>To set response headers:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -207,7 +207,7 @@ http://www.gnu.org/software/src-highlite --> the <a href="../cookies">Cookies</a> chapter for more information.</p></div> <div class="paragraph"><p>To check if a response header has already been set:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -215,7 +215,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>It returns <code>true</code> if the header was set, <code>false</code> otherwise.</p></div> <div class="paragraph"><p>To delete a response header that was set previously:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -269,7 +269,7 @@ headers.</p></div> default sends the server header with the value "Cowboy". We can override it:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -286,14 +286,14 @@ immediately sending it. It is stored in the Req object and sent when the reply function is called.</p></div> <div class="paragraph"><p>To set the response body:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> <pre><tt><span style="color: #009900">Req</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:set_resp_body</span></span>(<span style="color: #FF0000">"Hello world!"</span>, <span style="color: #009900">Req0</span>)<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>To check if a response body has already been set:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -312,7 +312,7 @@ using <code>cowboy_req:reply/4</code>, or when presetting the response header, you can give a <code>sendfile</code> tuple to Cowboy:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -323,7 +323,7 @@ entire file may be sent, or just a part of it.</p></div> Cowboy sends it in the content-length header.</p></div> <div class="paragraph"><p>To send a file while replying:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -352,7 +352,7 @@ string, set to empty) and the method is GET by default.</p></div> <div class="paragraph"><p>The following snippet pushes a CSS file that is linked to in the response:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -368,7 +368,7 @@ http://www.gnu.org/software/src-highlite --> simply pass in a fourth argument. The following snippet uses a different host name:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -439,6 +439,8 @@ ultimately send a response to the client.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/rest_flowcharts/index.html b/docs/en/cowboy/2.0/guide/rest_flowcharts/index.html index 8d398a24..43a7f706 100644 --- a/docs/en/cowboy/2.0/guide/rest_flowcharts/index.html +++ b/docs/en/cowboy/2.0/guide/rest_flowcharts/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: REST flowcharts</title> @@ -361,6 +361,8 @@ the results for subsequent use.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/rest_handlers/index.html b/docs/en/cowboy/2.0/guide/rest_handlers/index.html index a39b88ed..7dc0f9fa 100644 --- a/docs/en/cowboy/2.0/guide/rest_handlers/index.html +++ b/docs/en/cowboy/2.0/guide/rest_handlers/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: REST handlers</title> @@ -78,7 +78,7 @@ describing the resource and modifying the machine’s behavior.</p></div> to all handlers. To use REST for the current request, this function must return a <code>cowboy_rest</code> tuple.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -400,6 +400,8 @@ cellspacing="0" cellpadding="4"> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/rest_principles/index.html b/docs/en/cowboy/2.0/guide/rest_principles/index.html index 6bb1a90c..1a37f5c8 100644 --- a/docs/en/cowboy/2.0/guide/rest_principles/index.html +++ b/docs/en/cowboy/2.0/guide/rest_principles/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: REST principles</title> @@ -270,6 +270,8 @@ anything specific to the service to operate on it.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/routing/index.html b/docs/en/cowboy/2.0/guide/routing/index.html index 715b4111..70e53566 100644 --- a/docs/en/cowboy/2.0/guide/routing/index.html +++ b/docs/en/cowboy/2.0/guide/routing/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Routing</title> @@ -80,7 +80,7 @@ The result of the compilation is the dispatch rules.</p></div> <div class="sectionbody"> <div class="paragraph"><p>The general structure for the routes is defined as follow.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>Each host contains matching rules for the host along with optional constraints, and a list of routes for the path component.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -97,7 +97,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>The list of routes for the path component is defined similar to the list of hosts.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -106,7 +106,7 @@ http://www.gnu.org/software/src-highlite --> optional constraints, and gives us the handler module to be used along with its initial state.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -130,7 +130,7 @@ when encountered.</p></div> the simplest match value is a host or a path. It can be given as either a <code>string()</code> or a <code>binary()</code>.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -142,7 +142,7 @@ http://www.gnu.org/software/src-highlite --> character. Note that these two paths are identical as far as routing is concerned.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -151,7 +151,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>Hosts with and without a trailing dot are equivalent for routing. Similarly, hosts with and without a leading dot are also equivalent.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -165,7 +165,7 @@ values bindings.</p></div> the <code>:</code> 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.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -184,7 +184,7 @@ variable in Erlang. Any match against the <code>_</code> binding will succeed but the data will be discarded. This is especially useful for matching against many domain names in one go.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -192,7 +192,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>Similarly, it is possible to have optional segments. Anything between brackets is optional.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -200,7 +200,7 @@ http://www.gnu.org/software/src-highlite --> <span style="color: #009900">HostMatch</span> <span style="color: #990000">=</span> <span style="color: #FF0000">"[www.]ninenines.eu"</span><span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>You can also have imbricated optional segments.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -213,7 +213,7 @@ zero, one or many segments. You can then find the segments using <code>cowboy_req:host_info/1</code> and <code>cowboy_req:path_info/1</code> respectively. They will be represented as a list of segments.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -223,7 +223,7 @@ http://www.gnu.org/software/src-highlite --> will succeed only if they share the same value. This copies the Erlang pattern matching behavior.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -232,7 +232,7 @@ http://www.gnu.org/software/src-highlite --> case the two values must be identical only if the segment is available.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -240,7 +240,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>If a binding is defined in both the host and path, then they must also share the same value.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -249,7 +249,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>Finally, there are two special match values that can be used. The first is the atom <code>'_'</code> which will match any host or path.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -258,7 +258,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>The second is the special host match <code>"*"</code> which will match the wildcard path, generally used alongside the <code>OPTIONS</code> method.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -291,7 +291,7 @@ Faster compilation strategies could be to compile the routes directly to Erlang code, but would require heavier dependencies.</p></div> <div class="paragraph"><p>To compile routes, just call the appropriate function:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -313,7 +313,7 @@ http://www.gnu.org/software/src-highlite --> list used by routing. This will apply to all new connections accepted by the listener:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -378,6 +378,8 @@ http://www.gnu.org/software/src-highlite --> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/specs/index.html b/docs/en/cowboy/2.0/guide/specs/index.html index 658a452c..ac5e8483 100644 --- a/docs/en/cowboy/2.0/guide/specs/index.html +++ b/docs/en/cowboy/2.0/guide/specs/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: HTTP and other specifications</title> @@ -952,6 +952,8 @@ for or related to HTTP.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/static_files/index.html b/docs/en/cowboy/2.0/guide/static_files/index.html index a60d9564..03456b77 100644 --- a/docs/en/cowboy/2.0/guide/static_files/index.html +++ b/docs/en/cowboy/2.0/guide/static_files/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Static files</title> @@ -88,7 +88,7 @@ to the given application’s private directory.</p></div> from the application <code>my_app</code>'s priv directory whenever the path <code>/</code> is accessed:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -96,7 +96,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>You can also specify the absolute path to a file, or the path to the file relative to the current directory:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -118,7 +118,7 @@ private directory.</p></div> <code>my_app</code>'s priv directory inside the <code>static/assets</code> folder whenever the requested path begins with <code>/assets/</code>:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -126,7 +126,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>You can also specify the absolute path to the directory or set it relative to the current directory:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -152,7 +152,7 @@ you may have. You can of course create your own function.</p></div> anything, as it is the default. If you insist, though, the following will do the job:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -164,7 +164,7 @@ types have this optional field.</p></div> <div class="paragraph"><p>To use the function that will detect almost any mimetype, the following configuration will do:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -174,7 +174,7 @@ http://www.gnu.org/software/src-highlite --> expects a module and a function name, so you can use any of your own functions instead:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -194,7 +194,7 @@ directly to disk.</p></div> This is especially useful in combination with the <code>file</code> and <code>priv_file</code> options as it avoids needless computation:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -213,7 +213,7 @@ file metadata will vary from server to server, giving a different etag on each server.</p></div> <div class="paragraph"><p>You can however change the way the etag is calculated:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -226,7 +226,7 @@ file path to retrieve an etag value that is identical across all your servers.</p></div> <div class="paragraph"><p>You can also completely disable etag handling:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -290,6 +290,8 @@ http://www.gnu.org/software/src-highlite --> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/streams/index.html b/docs/en/cowboy/2.0/guide/streams/index.html index 393328b5..7abf3a07 100644 --- a/docs/en/cowboy/2.0/guide/streams/index.html +++ b/docs/en/cowboy/2.0/guide/streams/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Streams</title> @@ -178,6 +178,8 @@ that will modify responses.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/ws_handlers/index.html b/docs/en/cowboy/2.0/guide/ws_handlers/index.html index 4a450e1d..882f9e24 100644 --- a/docs/en/cowboy/2.0/guide/ws_handlers/index.html +++ b/docs/en/cowboy/2.0/guide/ws_handlers/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Websocket handlers</title> @@ -83,7 +83,7 @@ close the connection.</p></div> To establish a Websocket connection, you must switch to the <code>cowboy_websocket</code> module:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -118,7 +118,7 @@ Websocket, and provide the header:</p></div> <div class="paragraph"><p>This selection must be done in <code>init/2</code>. An example usage could be:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -154,7 +154,7 @@ from the connection process.</p></div> or be tied to the current pid, will not work as intended. The optional <code>websocket_init/1</code> can be used instead:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -165,7 +165,7 @@ http://www.gnu.org/software/src-highlite --> means that we can send frames to the client right after the upgrade:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -183,7 +183,7 @@ send frames back to the client or stop the connection.</p></div> <div class="paragraph"><p>The following snippet echoes back any text frame received and ignores all others:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -206,7 +206,7 @@ send frames to the client or stop the connection.</p></div> <div class="paragraph"><p>The following snippet forwards log messages to the client and ignores all others:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -223,7 +223,7 @@ http://www.gnu.org/software/src-highlite --> send zero, one or many frames to the client.</p></div> <div class="paragraph"><p>To send nothing, just return an ok tuple:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -231,7 +231,7 @@ http://www.gnu.org/software/src-highlite --> {<span style="color: #FF6600">ok</span>, <span style="color: #009900">State</span>}<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>To send one frame, return a reply tuple with the frame to send:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -242,7 +242,7 @@ or close frames.</p></div> <div class="paragraph"><p>To send many frames at once, return a reply tuple with the list of frames to send:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -275,7 +275,7 @@ than needed.</p></div> for the connection. For example, this would make Cowboy close connections idle for more than 30 seconds:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -293,7 +293,7 @@ http://www.gnu.org/software/src-highlite --> after the callback returns.</p></div> <div class="paragraph"><p>Simply add an <code>hibernate</code> field to the ok or reply tuples:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -319,7 +319,7 @@ for the more busy connections.</p></div> Cowboy to stop it or by sending a close frame.</p></div> <div class="paragraph"><p>To tell Cowboy to close the connection, use a stop tuple:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -387,6 +387,8 @@ close frame will not be sent.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> diff --git a/docs/en/cowboy/2.0/guide/ws_protocol/index.html b/docs/en/cowboy/2.0/guide/ws_protocol/index.html index aaae883a..1dfa8145 100644 --- a/docs/en/cowboy/2.0/guide/ws_protocol/index.html +++ b/docs/en/cowboy/2.0/guide/ws_protocol/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: The Websocket protocol</title> @@ -187,6 +187,8 @@ extensions.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> |