+</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