Skip to main content

start_http2

Function start_http2 

Source
pub async fn start_http2(server: Server) -> Result<(), ServerError>
Available on crate feature http2 only.
Expand description

Starts an HTTP/2 (h2c) accept loop backed by Tokio.

Each accepted TCP connection is upgraded to an h2 server connection and each stream is handled using the same request->response logic used by the HTTP/1 server.

§Examples

use http_handle::http2_server::start_http2;
use http_handle::Server;
let server = Server::new("127.0.0.1:8080", ".");
let _ = start_http2(server).await;

§Errors

Returns an error when binding or accepting HTTP/2 connections fails.

§Panics

This function does not panic.