26 lines
597 B
Rust
26 lines
597 B
Rust
use bytes::{Bytes, buf::Reader};
|
|
use std::sync::{Arc, Condvar, Mutex};
|
|
use tokio::sync::Notify;
|
|
|
|
use warp::http;
|
|
|
|
pub struct HttpListener {
|
|
pub incoming: std::sync::mpsc::Receiver<HttpRequest>,
|
|
pub warp_shutdown: Arc<Notify>,
|
|
}
|
|
|
|
pub struct HttpRequest {
|
|
pub request_data: HttpRequestData,
|
|
pub response: HttpResponse,
|
|
}
|
|
|
|
pub type HttpResponse = Arc<(Mutex<bool>, Mutex<Option<warp::reply::Response>>, Condvar)>;
|
|
|
|
pub struct HttpRequestData {
|
|
pub method: http::Method,
|
|
pub headers: http::HeaderMap,
|
|
pub path: String,
|
|
pub query: String,
|
|
pub body: Reader<Bytes>,
|
|
}
|