1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-28 10:02:38 +01:00

export Uri

This commit is contained in:
Nikolay Kim 2018-10-11 20:15:10 -07:00
parent 06addd5523
commit b960b5827c
4 changed files with 15 additions and 11 deletions

View File

@ -22,7 +22,7 @@ pub struct H1Service<T, S> {
impl<T, S> H1Service<T, S> impl<T, S> H1Service<T, S>
where where
S: NewService, S: NewService<Request = Request, Response = Response> + Clone,
S::Service: Clone, S::Service: Clone,
S::Error: Debug, S::Error: Debug,
{ {

View File

@ -110,7 +110,7 @@ mod json;
mod payload; mod payload;
mod request; mod request;
mod response; mod response;
mod uri; pub mod uri;
pub mod error; pub mod error;
pub mod h1; pub mod h1;
@ -148,10 +148,11 @@ pub mod http {
//! Various HTTP related types //! Various HTTP related types
// re-exports // re-exports
pub use modhttp::header::{HeaderName, HeaderValue};
pub use modhttp::{Method, StatusCode, Version}; pub use modhttp::{Method, StatusCode, Version};
#[doc(hidden)] #[doc(hidden)]
pub use modhttp::{uri, Error, Extensions, HeaderMap, HttpTryFrom, Uri}; pub use modhttp::{uri, Error, HeaderMap, HttpTryFrom, Uri};
pub use cookie::{Cookie, CookieBuilder}; pub use cookie::{Cookie, CookieBuilder};

View File

@ -8,7 +8,7 @@ use http::{header, HeaderMap, Method, Uri, Version};
use extensions::Extensions; use extensions::Extensions;
use httpmessage::HttpMessage; use httpmessage::HttpMessage;
use payload::Payload; use payload::Payload;
use uri::Url as InnerUrl; use uri::Url;
bitflags! { bitflags! {
pub(crate) struct MessageFlags: u8 { pub(crate) struct MessageFlags: u8 {
@ -25,7 +25,7 @@ pub struct Request {
pub(crate) struct InnerRequest { pub(crate) struct InnerRequest {
pub(crate) version: Version, pub(crate) version: Version,
pub(crate) method: Method, pub(crate) method: Method,
pub(crate) url: InnerUrl, pub(crate) url: Url,
pub(crate) flags: Cell<MessageFlags>, pub(crate) flags: Cell<MessageFlags>,
pub(crate) headers: HeaderMap, pub(crate) headers: HeaderMap,
pub(crate) extensions: RefCell<Extensions>, pub(crate) extensions: RefCell<Extensions>,
@ -73,7 +73,7 @@ impl Request {
inner: Rc::new(InnerRequest { inner: Rc::new(InnerRequest {
pool, pool,
method: Method::GET, method: Method::GET,
url: InnerUrl::default(), url: Url::default(),
version: Version::HTTP_11, version: Version::HTTP_11,
headers: HeaderMap::with_capacity(16), headers: HeaderMap::with_capacity(16),
flags: Cell::new(MessageFlags::empty()), flags: Cell::new(MessageFlags::empty()),
@ -94,7 +94,7 @@ impl Request {
} }
#[inline] #[inline]
pub(crate) fn url(&self) -> &InnerUrl { pub fn url(&self) -> &Url {
&self.inner().url &self.inner().url
} }
@ -162,7 +162,10 @@ impl Request {
self.inner().method == Method::CONNECT self.inner().method == Method::CONNECT
} }
pub(crate) fn clone(&self) -> Self { #[doc(hidden)]
/// Note: this method should be called only as part of clone operation
/// of wrapper type.
pub fn clone_request(&self) -> Self {
Request { Request {
inner: self.inner.clone(), inner: self.inner.clone(),
} }

View File

@ -32,11 +32,11 @@ fn set_bit(array: &mut [u8], ch: u8) {
} }
lazy_static! { lazy_static! {
static ref DEFAULT_QUOTER: Quoter = { Quoter::new(b"@:", b"/+") }; pub static ref DEFAULT_QUOTER: Quoter = { Quoter::new(b"@:", b"/+") };
} }
#[derive(Default, Clone, Debug)] #[derive(Default, Clone, Debug)]
pub(crate) struct Url { pub struct Url {
uri: Uri, uri: Uri,
path: Option<Rc<String>>, path: Option<Rc<String>>,
} }
@ -61,7 +61,7 @@ impl Url {
} }
} }
pub(crate) struct Quoter { pub struct Quoter {
safe_table: [u8; 16], safe_table: [u8; 16],
protected_table: [u8; 16], protected_table: [u8; 16],
} }