support async gzip decoding

This commit is contained in:
Ashley Mannix
2017-08-18 19:43:06 +10:00
parent aee559bdea
commit e2fa97254e
10 changed files with 605 additions and 203 deletions

View File

@@ -52,7 +52,6 @@ pub struct Client {
/// # }
/// ```
pub struct ClientBuilder {
gzip: bool,
inner: async_impl::ClientBuilder,
timeout: Option<Duration>,
}
@@ -66,7 +65,6 @@ impl ClientBuilder {
pub fn new() -> ::Result<ClientBuilder> {
async_impl::ClientBuilder::new().map(|builder| ClientBuilder {
inner: builder,
gzip: true,
timeout: None,
})
}
@@ -150,7 +148,6 @@ impl ClientBuilder {
#[inline]
pub fn gzip(&mut self, enable: bool) -> &mut ClientBuilder {
self.inner.gzip(enable);
self.gzip = enable;
self
}
@@ -312,7 +309,6 @@ impl fmt::Debug for ClientBuilder {
#[derive(Clone)]
struct ClientHandle {
gzip: bool,
timeout: Option<Duration>,
inner: Arc<InnerClientHandle>
}
@@ -334,7 +330,6 @@ impl Drop for InnerClientHandle {
impl ClientHandle {
fn new(builder: &mut ClientBuilder) -> ::Result<ClientHandle> {
let gzip = builder.gzip;
let timeout = builder.timeout;
let mut builder = async_impl::client::take_builder(&mut builder.inner);
let (tx, rx) = mpsc::unbounded();
@@ -383,7 +378,6 @@ impl ClientHandle {
Ok(ClientHandle {
gzip: gzip,
timeout: timeout,
inner: inner_handle,
})
@@ -412,7 +406,7 @@ impl ClientHandle {
}
};
res.map(|res| {
response::new(res, self.gzip, self.timeout, KeepCoreThreadAlive(self.inner.clone()))
response::new(res, self.timeout, KeepCoreThreadAlive(self.inner.clone()))
})
}
}