Struct attohttpc::Session[][src]

pub struct Session { /* fields omitted */ }

Session is a type that can carry settings over multiple requests. The settings applied to the Session are applied to every request created from this Session.

Implementations

impl Session[src]

pub fn new() -> Session[src]

Create a new Session with default settings.

pub fn get<U>(&self, base_url: U) -> RequestBuilder where
    U: AsRef<str>, 
[src]

Create a new RequestBuilder with the GET method and this Session's settings applied on it.

pub fn post<U>(&self, base_url: U) -> RequestBuilder where
    U: AsRef<str>, 
[src]

Create a new RequestBuilder with the POST method and this Session's settings applied on it.

pub fn put<U>(&self, base_url: U) -> RequestBuilder where
    U: AsRef<str>, 
[src]

Create a new RequestBuilder with the PUT method and this Session's settings applied on it.

pub fn delete<U>(&self, base_url: U) -> RequestBuilder where
    U: AsRef<str>, 
[src]

Create a new RequestBuilder with the DELETE method and this Session's settings applied on it.

pub fn head<U>(&self, base_url: U) -> RequestBuilder where
    U: AsRef<str>, 
[src]

Create a new RequestBuilder with the HEAD method and this Session's settings applied on it.

pub fn options<U>(&self, base_url: U) -> RequestBuilder where
    U: AsRef<str>, 
[src]

Create a new RequestBuilder with the OPTIONS method and this Session's settings applied on it.

pub fn patch<U>(&self, base_url: U) -> RequestBuilder where
    U: AsRef<str>, 
[src]

Create a new RequestBuilder with the PATCH method and this Session's settings applied on it.

pub fn trace<U>(&self, base_url: U) -> RequestBuilder where
    U: AsRef<str>, 
[src]

Create a new RequestBuilder with the TRACE method and this Session's settings applied on it.

pub fn header<H, V>(&mut self, header: H, value: V) where
    H: IntoHeaderName,
    V: TryInto<HeaderValue>,
    Error: From<V::Error>, 
[src]

Modify a header for this Request.

If the header is already present, the value will be replaced. If you wish to append a new header, use header_append.

Panics

This method will panic if the value is invalid.

pub fn header_append<H, V>(&mut self, header: H, value: V) where
    H: IntoHeaderName,
    V: TryInto<HeaderValue>,
    Error: From<V::Error>, 
[src]

Append a new header for this Request.

The new header is always appended to the request, even if the header already exists.

Panics

This method will panic if the value is invalid.

pub fn try_header<H, V>(&mut self, header: H, value: V) -> Result<()> where
    H: IntoHeaderName,
    V: TryInto<HeaderValue>,
    Error: From<V::Error>, 
[src]

Modify a header for this Request.

If the header is already present, the value will be replaced. If you wish to append a new header, use header_append.

pub fn try_header_append<H, V>(&mut self, header: H, value: V) -> Result<()> where
    H: IntoHeaderName,
    V: TryInto<HeaderValue>,
    Error: From<V::Error>, 
[src]

Append a new header to this Request.

The new header is always appended to the Request, even if the header already exists.

pub fn max_redirections(&mut self, max_redirections: u32)[src]

Set the maximum number of redirections this Request can perform.

The default is 5.

pub fn follow_redirects(&mut self, follow_redirects: bool)[src]

Sets if this Request should follow redirects, 3xx codes.

This value defaults to true.

pub fn connect_timeout(&mut self, duration: Duration)[src]

Sets a connect timeout for this request.

The default is 30 seconds.

pub fn read_timeout(&mut self, duration: Duration)[src]

Sets a read timeout for this request.

The default is 30 seconds.

pub fn timeout(&mut self, duration: Duration)[src]

Sets a timeout for the whole request.

Applies after a TCP connection is established. Defaults to no timeout.

pub fn proxy_settings(&mut self, settings: ProxySettings)[src]

Sets the proxy settigns for this request.

If left untouched, the defaults are to use system proxy settings found in environment variables.

pub fn default_charset(&mut self, default_charset: Option<Charset>)[src]

Set the default charset to use while parsing the response of this Request.

If the response does not say which charset it uses, this charset will be used to decode the request. This value defaults to None, in which case ISO-8859-1 is used.

pub fn allow_compression(&mut self, allow_compression: bool)[src]

Sets if this Request will announce that it accepts compression.

This value defaults to true. Note that this only lets the browser know that this Request supports compression, the server might choose not to compress the content.

pub fn danger_accept_invalid_certs(&mut self, accept_invalid_certs: bool)[src]

Sets if this Request will accept invalid TLS certificates.

Accepting invalid certificates implies that invalid hostnames are accepted as well.

The default value is false.

Danger

Use this setting with care. This will accept any TLS certificate valid or not. If you are using self signed certificates, it is much safer to add their root CA to the list of trusted root CAs by your system.

pub fn danger_accept_invalid_hostnames(
    &mut self,
    accept_invalid_hostnames: bool
)
[src]

Sets if this Request will accept an invalid hostname in a TLS certificate.

The default value is false.

Danger

Use this setting with care. This will accept TLS certificates that do not match the hostname.

pub fn add_root_certificate(&mut self, cert: Certificate)[src]

Adds a root certificate that will be trusted.

Trait Implementations

impl Debug for Session[src]

impl Default for Session[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DebugAny for T where
    T: Any + Debug

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<T> UnsafeAny for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,