1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-30 20:04:26 +02:00

add custom request path quoter #182

This commit is contained in:
Nikolay Kim
2018-04-17 12:55:13 -07:00
parent 3a79505a44
commit a826d113ee
12 changed files with 236 additions and 35 deletions

View File

@ -19,6 +19,7 @@ use httprequest::HttpRequest;
use httpresponse::HttpResponse;
use payload::{Payload, PayloadStatus, PayloadWriter};
use pipeline::Pipeline;
use uri::Url;
use super::encoding::PayloadType;
use super::h1writer::H1Writer;
@ -527,7 +528,7 @@ impl Reader {
httparse::Status::Complete(len) => {
let method = Method::from_bytes(req.method.unwrap().as_bytes())
.map_err(|_| ParseError::Method)?;
let path = Uri::try_from(req.path.unwrap())?;
let path = Url::new(Uri::try_from(req.path.unwrap())?);
let version = if req.version.unwrap() == 1 {
Version::HTTP_11
} else {
@ -563,7 +564,7 @@ impl Reader {
}
}
msg_mut.uri = path;
msg_mut.url = path;
msg_mut.method = method;
msg_mut.version = version;
}

View File

@ -22,6 +22,7 @@ use httprequest::HttpRequest;
use httpresponse::HttpResponse;
use payload::{Payload, PayloadStatus, PayloadWriter};
use pipeline::Pipeline;
use uri::Url;
use super::encoding::PayloadType;
use super::h2writer::H2Writer;
@ -304,7 +305,7 @@ impl<H: 'static> Entry<H> {
let (psender, payload) = Payload::new(false);
let msg = settings.get_http_message();
msg.get_mut().uri = parts.uri;
msg.get_mut().url = Url::new(parts.uri);
msg.get_mut().method = parts.method;
msg.get_mut().version = parts.version;
msg.get_mut().headers = parts.headers;