1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 09:42:40 +01:00

fix 1.24 compatibility

This commit is contained in:
Nikolay Kim 2018-05-15 19:07:43 -07:00
parent f82fa08d72
commit 0d36b8f826
2 changed files with 7 additions and 10 deletions

View File

@ -88,7 +88,7 @@ impl fmt::Debug for Error {
}
}
/// `HttpResponse` for `Error`
/// Convert `Error` to a `HttpResponse` instance
impl From<Error> for HttpResponse {
fn from(err: Error) -> Self {
HttpResponse::from_error(err)
@ -317,10 +317,7 @@ pub enum HttpRangeError {
/// Return `BadRequest` for `HttpRangeError`
impl ResponseError for HttpRangeError {
fn error_response(&self) -> HttpResponse {
HttpResponse::with_body(
StatusCode::BAD_REQUEST,
"Invalid Range header provided",
)
HttpResponse::with_body(StatusCode::BAD_REQUEST, "Invalid Range header provided")
}
}

View File

@ -389,8 +389,8 @@ impl ContentEncoder {
let is_head = req.method == Method::HEAD;
let mut len = 0;
let has_body = match resp.body() {
Body::Empty => false,
Body::Binary(ref bin) => {
&Body::Empty => false,
&Body::Binary(ref bin) => {
len = bin.len();
!(response_encoding == ContentEncoding::Auto && len < 96)
}
@ -427,13 +427,13 @@ impl ContentEncoder {
};
let mut transfer = match resp.body() {
Body::Empty => {
&Body::Empty => {
if req.method != Method::HEAD {
resp.headers_mut().remove(CONTENT_LENGTH);
}
TransferEncoding::length(0, buf)
}
Body::Binary(_) => {
&Body::Binary(_) => {
if !(encoding == ContentEncoding::Identity
|| encoding == ContentEncoding::Auto)
{
@ -482,7 +482,7 @@ impl ContentEncoder {
}
TransferEncoding::eof(buf)
}
Body::Streaming(_) | Body::Actor(_) => {
&Body::Streaming(_) | &Body::Actor(_) => {
if resp.upgrade() {
if version == Version::HTTP_2 {
error!("Connection upgrade is forbidden for HTTP/2");