Struct mio_httpc::Httpc
[−]
[src]
pub struct Httpc { /* fields omitted */ }
Methods
impl Httpc
[src]
pub fn new(con_offset: usize, cfg: Option<HttpcCfg>) -> Httpc
[src]
Httpc will create connections with mio token in range [con_offset..con_offset+0xFFFF]
pub fn recfg(&mut self, cfg: HttpcCfg)
[src]
Reconfigure httpc.
pub fn open_connections(&self) -> usize
[src]
Number of currently open connections (in active and idle keep-alive state)
pub fn reuse(&mut self, buf: Vec<u8>)
[src]
Reuse a response buffer for subsequent calls.
pub fn call_close(&mut self, id: Call)
[src]
Prematurely finish call.
pub fn timeout(&mut self) -> Vec<CallRef>
[src]
Call periodically to check for call timeouts and DNS retries. Returns list of calls that have timed out. You must execute call_close yourself (or SimpleCall::abort) and timeout will return them every time until you do. (every 100ms for example)
pub fn timeout_extend<C: TlsConnector>(&mut self, out: &mut Vec<CallRef>)
[src]
Same as timeout except that timed out calls get appended. This way you can reuse old allocations (if you truncated to 0).
pub fn event(&mut self, ev: &Event) -> Option<CallRef>
[src]
Get CallRef for ev if token in configured range for Httpc. Compare CallRef external call.
First you must call call_send until you get a SendState::Receiving after that call is in receive state and you must call call_recv.
pub fn call_send(
&mut self,
poll: &Poll,
id: &mut Call,
buf: Option<&[u8]>
) -> SendState
[src]
&mut self,
poll: &Poll,
id: &mut Call,
buf: Option<&[u8]>
) -> SendState
If request has body it will be either taken from buf, from Request provided to CallBuilder or will return SendState::WaitReqBody.
buf slice is assumed to have taken previous SendState::SentBody(usize) into account and starts from part of buffer that has not been sent yet.
pub fn call_recv(
&mut self,
poll: &Poll,
id: &mut Call,
buf: Option<&mut Vec<u8>>
) -> RecvState
[src]
&mut self,
poll: &Poll,
id: &mut Call,
buf: Option<&mut Vec<u8>>
) -> RecvState
If no buf provided, response body (if any) is stored in an internal buffer. If buf provided after some body has been received, it will be copied to it.
Buf will be expanded if required. Bytes are always appended. If you want to receive response entirely in buf, you should reserve capacity for entire body before calling call_recv.
If body is only stored in internal buffer it will be limited to CallBuilder::max_response.