mirror of
https://github.com/actix/actix-web.git
synced 2024-12-20 23:26:44 +00:00
disable compression for static files
This commit is contained in:
parent
e919ec485e
commit
8a96e8fdd0
2 changed files with 5 additions and 6 deletions
|
@ -83,6 +83,8 @@ impl Responder for NamedFile {
|
|||
|
||||
fn respond_to(mut self, _: HttpRequest) -> Result<HttpResponse, io::Error> {
|
||||
let mut resp = HTTPOk.build();
|
||||
use headers::ContentEncoding;
|
||||
resp.content_encoding(ContentEncoding::Identity);
|
||||
if let Some(ext) = self.path().extension() {
|
||||
let mime = get_mime_type(&ext.to_string_lossy());
|
||||
resp.content_type(format!("{}", mime).as_str());
|
||||
|
|
|
@ -112,16 +112,13 @@ impl<T, H> Future for HttpChannel<T, H> where T: IoStream, H: HttpHandler + 'sta
|
|||
}
|
||||
return result
|
||||
},
|
||||
Some(HttpProtocol::Unknown(_, _, ref mut io, ref mut buf)) => {
|
||||
Some(HttpProtocol::Unknown(ref mut settings, _, ref mut io, ref mut buf)) => {
|
||||
match utils::read_from_io(io, buf) {
|
||||
Ok(Async::Ready(0)) => {
|
||||
Ok(Async::Ready(0)) | Err(_) => {
|
||||
debug!("Ignored premature client disconnection");
|
||||
settings.remove_channel();
|
||||
return Err(())
|
||||
},
|
||||
Err(err) => {
|
||||
debug!("Ignored premature client disconnection {}", err);
|
||||
return Err(())
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue