1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

Fix panic on invalid URL characters #130

This commit is contained in:
Nikolay Kim
2018-03-22 18:08:12 -07:00
parent b942bcc4a6
commit 5a25fd95f5
4 changed files with 21 additions and 11 deletions

View File

@@ -8,11 +8,10 @@ use cookie;
use httparse;
use actix::MailboxError;
use futures::Canceled;
use failure;
use failure::{Fail, Backtrace};
use failure::{self, Fail, Backtrace};
use http2::Error as Http2Error;
use http::{header, StatusCode, Error as HttpError};
use http::uri::InvalidUriBytes;
use http::uri::InvalidUri;
use http_range::HttpRangeParseError;
use serde_json::error::Error as JsonError;
pub use url::ParseError as UrlParseError;
@@ -157,7 +156,7 @@ pub enum ParseError {
Method,
/// An invalid `Uri`, such as `exam ple.domain`.
#[fail(display="Uri error: {}", _0)]
Uri(InvalidUriBytes),
Uri(InvalidUri),
/// An invalid `HttpVersion`, such as `HTP/1.1`
#[fail(display="Invalid HTTP version specified")]
Version,
@@ -198,6 +197,12 @@ impl From<IoError> for ParseError {
}
}
impl From<InvalidUri> for ParseError {
fn from(err: InvalidUri) -> ParseError {
ParseError::Uri(err)
}
}
impl From<Utf8Error> for ParseError {
fn from(err: Utf8Error) -> ParseError {
ParseError::Utf8(err)