Module connection

Source
Available on crate feature web_server only.
Expand description

A single connection (TCP or Unix) to an FCGI application.

Multiple Requests can be multiplexed on it.

§Example

use http::{Request, StatusCode};
use http_body::{Body};
use bytes::Bytes;
use async_fcgi::client::connection::Connection;

    let mut fcgi_con = Connection::connect(&"127.0.0.1:59000".parse()?, 1).await?;
    let req = Request::get("/test?lol=1").header("Accept", "text/html").body(String::new())?;
    let mut params = HashMap::new();
    params.insert(
        Bytes::from(&b"SCRIPT_FILENAME"[..]),
        Bytes::from(&b"/home/daniel/Public/test.php"[..]),
    );
    let mut res = fcgi_con.forward(req, params).await?;
    assert_eq!(res.status(), StatusCode::NOT_FOUND);
    assert_eq!(res.headers().get("X-Powered-By").unwrap(), "PHP/7.3.16");

Structs§

Connection
Single transport connection to a FCGI application

Enums§

HeaderMultilineStrategy
Specifies how to handle HTTP Headers that contain \n
MultiHeaderStrategy
Specifies how to handle multiple HTTP Headers