1use bytes::Bytes;
2use std::net::SocketAddr;
3
4pub const PROTOCOL_HTTP: &str = "http";
5pub const EVENT_HTTP: &str = "http";
6
7#[non_exhaustive]
8#[derive(Clone, Debug, Default)]
9pub struct HttpScope {
10 pub method: http::Method,
11 pub uri: http::Uri,
12 pub version: http::Version,
13 pub headers: http::HeaderMap,
14
15 pub server: Option<SocketAddr>,
16 pub client: Option<SocketAddr>,
17}
18
19#[non_exhaustive]
20#[derive(Clone, Debug)]
21pub enum HttpEvent {
22 RequestChunk(RequestChunk),
24 ResponseChunk(ResponseChunk),
26 ResponseStart(ResponseStart),
28 ResponseTrailer(ResponseTrailer),
30 Disconnect(Disconnect),
32}
33
34#[non_exhaustive]
35#[derive(Default, Clone, Debug)]
36pub struct RequestChunk {
37 pub body: Bytes,
38 pub more: bool,
39}
40
41#[non_exhaustive]
42#[derive(Default, Clone, Debug)]
43pub struct ResponseChunk {
44 pub body: Bytes,
45 pub more: bool,
46}
47
48#[non_exhaustive]
49#[derive(Default, Clone, Debug)]
50pub struct ResponseStart {
51 pub status: http::StatusCode,
52 pub headers: http::HeaderMap,
53 pub trailers: bool,
54}
55
56#[non_exhaustive]
57#[derive(Default, Clone, Debug)]
58pub struct ResponseTrailer {
59 pub headers: http::HeaderMap,
60 pub more: bool,
61}
62
63#[non_exhaustive]
64#[derive(Default, Clone, Debug)]
65pub struct Disconnect {}