Struct Request

Source
pub struct Request {
Show 41 fields pub config: Config, pub protocol: Protocol, pub method: Method, pub uri: String, pub app: String, pub timestamp: f64, pub datetime: String, pub server_ip: String, pub client_ip: String, pub agent_ip: String, pub origin: String, pub host: String, pub connection: Connection, pub user_agent: String, pub accept: String, pub accept_encoding: String, pub accept_language: String, pub cache_control: String, pub content_length: usize, pub content_body_length: usize, pub body: Vec<u8>, pub referer: String, pub content_type: RequestContentType, pub boundary: String, pub custom: JsonValue, pub path: String, pub query: String, pub post: JsonValue, pub text: String, pub html: String, pub get: JsonValue, pub files: JsonValue, pub authorization_mode: String, pub authorization_user: String, pub authorization_pass: String, pub authorization_token: String, pub authorization_data: String, pub is_origin: bool, pub upgrade: String, pub sec_web_socket_key: String, pub sec_web_socket_version: String, /* private fields */
}
Expand description

请求处理

Fields§

§config: Config§protocol: Protocol

协议版本

§method: Method

当前请求类型

§uri: String

请求地址

§app: String

应用名称

§timestamp: f64

请求时间戳

§datetime: String

当前时间

§server_ip: String

服务器IP

§client_ip: String

客户端IP

§agent_ip: String

代理IP

§origin: String

请求源

§host: String

当前访问域名或者IP 主机和端口号 头域

§connection: Connection

连接方式

§user_agent: String

客户端类型

§accept: String

客户端接受类型

§accept_encoding: String

客户端接受加密

§accept_language: String

客户端接受语言

§cache_control: String

缓存机制

§content_length: usize

请求内容的长度

§content_body_length: usize

请求消息体长度

§body: Vec<u8>

消息体

§referer: String

来源于

§content_type: RequestContentType

请求类型

§boundary: String

分界线

§custom: JsonValue

自定义参数

§path: String

路径

§query: String

查询条件

§post: JsonValue§text: String§html: String§get: JsonValue§files: JsonValue§authorization_mode: String

认证模式

§authorization_user: String§authorization_pass: String§authorization_token: String§authorization_data: String§is_origin: bool

是否有源

§upgrade: String

websocket

§sec_web_socket_key: String

websocket 密钥

§sec_web_socket_version: String

websocket 版本

Implementations§

Source§

impl Request

Source

pub fn new(config: Config, data: Vec<u8>) -> Result<Self, String>

Source

pub fn json(&mut self) -> JsonValue

Source

pub fn header(&mut self, data: Lines<'_>) -> &mut Self

Source

pub fn body(&mut self) -> Result<(), String>

Trait Implementations§

Source§

impl Clone for Request

Source§

fn clone(&self) -> Request

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Request

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.