Skip to content

Commit 366ea20

Browse files
committed
Deploying to master from @ actix/actix-website@f504c65 🚀
1 parent 34bdec0 commit 366ea20

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

docs/server/index.html

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,4 @@
9898
</span><span class=w>
9999
</span><span class=w> </span><span class=nb>Ok</span><span class=p>(())</span><span class=w>
100100
</span><span class=w></span><span class=p>}</span><span class=w>
101-
</span></code></pre></div><p>If the first option above is selected, then <em>keep alive</em> state is calculated based on the response&rsquo;s <em>connection-type</em>. By default <code>HttpResponse::connection_type</code> is not defined. In that case -keep-alive is defined by the request&rsquo;s HTTP version.</p><blockquote><p>Keep-alive is <strong>off</strong> for HTTP/1.0 and is <strong>on</strong> for HTTP/1.1 and HTTP/2.0.</p></blockquote><p><em>Connection type</em> can be changed with <code>HttpResponseBuilder::connection_type()</code> method.</p><div class=highlight><pre class=chroma><code class=language-rust data-lang=rust><span class=k>use</span><span class=w> </span><span class=n>actix_web</span>::<span class=p>{</span><span class=n>http</span><span class=p>,</span><span class=w> </span><span class=n>HttpRequest</span><span class=p>,</span><span class=w> </span><span class=n>HttpResponse</span><span class=p>};</span><span class=w>
102-
</span><span class=w>
103-
</span><span class=w></span><span class=k>async</span><span class=w> </span><span class=k>fn</span> <span class=nf>index</span><span class=p>(</span><span class=n>req</span>: <span class=nc>HttpRequest</span><span class=p>)</span><span class=w> </span>-&gt; <span class=nc>HttpResponse</span><span class=w> </span><span class=p>{</span><span class=w>
104-
</span><span class=w> </span><span class=n>HttpResponse</span>::<span class=nb>Ok</span><span class=p>()</span><span class=w>
105-
</span><span class=w> </span><span class=p>.</span><span class=n>connection_type</span><span class=p>(</span><span class=n>http</span>::<span class=n>ConnectionType</span>::<span class=n>Close</span><span class=p>)</span><span class=w> </span><span class=c1>// &lt;- Close connection
106-
</span><span class=c1></span><span class=w> </span><span class=p>.</span><span class=n>force_close</span><span class=p>()</span><span class=w> </span><span class=c1>// &lt;- Alternative method
107-
</span><span class=c1></span><span class=w> </span><span class=p>.</span><span class=n>finish</span><span class=p>()</span><span class=w>
108-
</span><span class=w></span><span class=p>}</span><span class=w>
109-
</span></code></pre></div><h2 id=graceful-shutdown>Graceful shutdown</h2><p><code>HttpServer</code> supports graceful shutdown. After receiving a stop signal, workers have a specific amount of time to finish serving requests. Any workers still alive after the timeout are force-dropped. By default the shutdown timeout is set to 30 seconds. You can change this parameter with the <a href=https://docs.rs/actix-web/3/actix_web/struct.HttpServer.html#method.shutdown_timeout><code>HttpServer::shutdown_timeout()</code></a> method.</p><p><code>HttpServer</code> handles several OS signals. <em>CTRL-C</em> is available on all OSes, other signals are available on unix systems.</p><ul><li><em>SIGINT</em> - Force shutdown workers</li><li><em>SIGTERM</em> - Graceful shutdown workers</li><li><em>SIGQUIT</em> - Force shutdown workers</li></ul><blockquote><p>It is possible to disable signal handling with <a href=https://docs.rs/actix-web/3/actix_web/struct.HttpServer.html#method.disable_signals><code>HttpServer::disable_signals()</code></a> method.</p></blockquote><div class=github-edit><a class="fa fa-github" href=https://github.com/actix/actix-website/tree/master/content/docs/server.md>Edit on GitHub</a></div><div class=actix-next><b>Next up</b>: <a href=/docs/handlers/>Handlers</a></div></div></div></div></div><footer class=actix-footer><div class="text-muted actix-footer-gray d-flex justify-content-between"><div class=actix-footer-info>Copyright © 2022 The Actix Team</div><div class=actix-footer-social><a href=https://github.com/actix class=text-muted><i class="fa fa-github" aria-hidden=true></i></a></div></div></footer><script src=https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js integrity=sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7 crossorigin=anonymous></script><script src=https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/js/tether.min.js integrity=sha384-XTs3FgkjiBgo8qjEjBk0tGmf3wPrWtA6coPfQDfFEY8AnYJwjalXCiosYRBIBZX8 crossorigin=anonymous></script><script src=https://actix.rs/js/bootstrap.min.js></script><script src=https://actix.rs/js/actix.js></script></body></html>
101+
</span></code></pre></div><p>If the first option above is selected, then keep-alive is enabled for HTTP/1.1 requests if the response does not explicitly disallow it by, for example, setting the <a href=https://docs.rs/actix-web/3/actix_web/http/enum.ConnectionType.html>connection type</a> to <code>Close</code> or <code>Upgrade</code>. Force closing a connection can be done with <a href=https://docs.rs/actix-web/3/actix_web/dev/struct.HttpResponseBuilder.html#method.force_close>the <code>force_close()</code> method on <code>HttpResponseBuilder</code></a></p><blockquote><p>Keep-alive is <strong>off</strong> for HTTP/1.0 and is <strong>on</strong> for HTTP/1.1 and HTTP/2.0.</p></blockquote><h2 id=graceful-shutdown>Graceful shutdown</h2><p><code>HttpServer</code> supports graceful shutdown. After receiving a stop signal, workers have a specific amount of time to finish serving requests. Any workers still alive after the timeout are force-dropped. By default the shutdown timeout is set to 30 seconds. You can change this parameter with the <a href=https://docs.rs/actix-web/3/actix_web/struct.HttpServer.html#method.shutdown_timeout><code>HttpServer::shutdown_timeout()</code></a> method.</p><p><code>HttpServer</code> handles several OS signals. <em>CTRL-C</em> is available on all OSes, other signals are available on unix systems.</p><ul><li><em>SIGINT</em> - Force shutdown workers</li><li><em>SIGTERM</em> - Graceful shutdown workers</li><li><em>SIGQUIT</em> - Force shutdown workers</li></ul><blockquote><p>It is possible to disable signal handling with <a href=https://docs.rs/actix-web/3/actix_web/struct.HttpServer.html#method.disable_signals><code>HttpServer::disable_signals()</code></a> method.</p></blockquote><div class=github-edit><a class="fa fa-github" href=https://github.com/actix/actix-website/tree/master/content/docs/server.md>Edit on GitHub</a></div><div class=actix-next><b>Next up</b>: <a href=/docs/handlers/>Handlers</a></div></div></div></div></div><footer class=actix-footer><div class="text-muted actix-footer-gray d-flex justify-content-between"><div class=actix-footer-info>Copyright © 2022 The Actix Team</div><div class=actix-footer-social><a href=https://github.com/actix class=text-muted><i class="fa fa-github" aria-hidden=true></i></a></div></div></footer><script src=https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js integrity=sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7 crossorigin=anonymous></script><script src=https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/js/tether.min.js integrity=sha384-XTs3FgkjiBgo8qjEjBk0tGmf3wPrWtA6coPfQDfFEY8AnYJwjalXCiosYRBIBZX8 crossorigin=anonymous></script><script src=https://actix.rs/js/bootstrap.min.js></script><script src=https://actix.rs/js/actix.js></script></body></html>

0 commit comments

Comments
 (0)