mirror of
https://github.com/actix/actix-extras.git
synced 2024-12-01 02:44:37 +01:00
fix 1.24 compatibility
This commit is contained in:
parent
f82fa08d72
commit
0d36b8f826
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user