Skip to main content

WebRequest

Trait WebRequest 

Source
pub trait WebRequest {
    // Required methods
    fn params(&self) -> &[(String, String)];
    fn read_body(&mut self, buf: &mut [u8]) -> usize;
    fn send_headers(&mut self, status: u16, headers: &[String]) -> bool;
    fn write(&mut self, data: &[u8]) -> bool;
}
Expand description

One HTTP request, as PHP sees it.

Required Methods§

Source

fn params(&self) -> &[(String, String)]

The CGI/1.1 parameters, which become $_SERVER (SCRIPT_FILENAME, REQUEST_METHOD, HTTP_*, …).

Source

fn read_body(&mut self, buf: &mut [u8]) -> usize

Reads the request body; 0 at its end (or when it cannot be read).

Source

fn send_headers(&mut self, status: u16, headers: &[String]) -> bool

The response status and header lines (Name: value), once, before any body.

Source

fn write(&mut self, data: &[u8]) -> bool

Response body bytes; false when the client is gone.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§