1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-01 14:01:37 +00:00

update dependencies

This commit is contained in:
Nikolay Kim 2019-08-13 10:48:11 -07:00
parent 192dfff680
commit 55179d6ab2
17 changed files with 97 additions and 47 deletions

View file

@ -12,6 +12,8 @@
* `Query` payload made `pub`. Allows user to pattern-match the payload. * `Query` payload made `pub`. Allows user to pattern-match the payload.
* Update serde_urlencoded to "0.6.1"
## [1.0.5] - 2019-07-18 ## [1.0.5] - 2019-07-18

View file

@ -96,7 +96,7 @@ parking_lot = "0.9"
regex = "1.0" regex = "1.0"
serde = { version = "1.0", features=["derive"] } serde = { version = "1.0", features=["derive"] }
serde_json = "1.0" serde_json = "1.0"
serde_urlencoded = "0.5.3" serde_urlencoded = "0.6.1"
time = "0.1.42" time = "0.1.42"
url = { version="1.7", features=["query_encoding"] } url = { version="1.7", features=["query_encoding"] }

View file

@ -4,6 +4,8 @@
* Bump up `mime_guess` crate version to 2.0.1 * Bump up `mime_guess` crate version to 2.0.1
* Bump up `percent-encoding` crate version to 2.1
## [0.1.4] - 2019-07-20 ## [0.1.4] - 2019-07-20
* Allow to disable `Content-Disposition` header #686 * Allow to disable `Content-Disposition` header #686

View file

@ -28,7 +28,7 @@ derive_more = "0.15.0"
log = "0.4" log = "0.4"
mime = "0.3" mime = "0.3"
mime_guess = "2.0.1" mime_guess = "2.0.1"
percent-encoding = "1.0" percent-encoding = "2.1"
v_htmlescape = "0.4" v_htmlescape = "0.4"
[dev-dependencies] [dev-dependencies]

View file

@ -23,7 +23,7 @@ use futures::future::{ok, Either, FutureResult};
use futures::{Async, Future, Poll, Stream}; use futures::{Async, Future, Poll, Stream};
use mime; use mime;
use mime_guess::from_ext; use mime_guess::from_ext;
use percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET}; use percent_encoding::{utf8_percent_encode, CONTROLS};
use v_htmlescape::escape as escape_html_entity; use v_htmlescape::escape as escape_html_entity;
mod error; mod error;
@ -144,7 +144,7 @@ impl Directory {
// show file url as relative to static path // show file url as relative to static path
macro_rules! encode_file_url { macro_rules! encode_file_url {
($path:ident) => { ($path:ident) => {
utf8_percent_encode(&$path.to_string_lossy(), DEFAULT_ENCODE_SET) utf8_percent_encode(&$path.to_string_lossy(), CONTROLS)
}; };
} }

View file

@ -6,6 +6,10 @@
* Dropped the `byteorder`-dependency in favor of `stdlib`-implementation * Dropped the `byteorder`-dependency in favor of `stdlib`-implementation
* Update percent-encoding to 2.1
* Update serde_urlencoded to 0.6.1
### Fixed ### Fixed
* Fixed a panic in the HTTP2 handshake in client HTTP requests (#1031) * Fixed a panic in the HTTP2 handshake in client HTTP requests (#1031)

View file

@ -71,14 +71,14 @@ lazy_static = "1.0"
language-tags = "0.2" language-tags = "0.2"
log = "0.4" log = "0.4"
mime = "0.3" mime = "0.3"
percent-encoding = "1.0" percent-encoding = "2.1"
rand = "0.7" rand = "0.7"
regex = "1.0" regex = "1.0"
serde = "1.0" serde = "1.0"
serde_json = "1.0" serde_json = "1.0"
sha1 = "0.6" sha1 = "0.6"
slab = "0.4" slab = "0.4"
serde_urlencoded = "0.5.5" serde_urlencoded = "0.6.1"
time = "0.1.42" time = "0.1.42"
tokio-tcp = "0.1.3" tokio-tcp = "0.1.3"
tokio-timer = "0.2.8" tokio-timer = "0.2.8"

View file

@ -66,7 +66,7 @@ use std::fmt;
use std::str::FromStr; use std::str::FromStr;
use chrono::Duration; use chrono::Duration;
use percent_encoding::{percent_encode, USERINFO_ENCODE_SET}; use percent_encoding::{percent_encode, AsciiSet, CONTROLS};
use time::Tm; use time::Tm;
pub use self::builder::CookieBuilder; pub use self::builder::CookieBuilder;
@ -75,6 +75,25 @@ pub use self::jar::{CookieJar, Delta, Iter};
use self::parse::parse_cookie; use self::parse::parse_cookie;
pub use self::parse::ParseError; pub use self::parse::ParseError;
/// https://url.spec.whatwg.org/#fragment-percent-encode-set
const FRAGMENT: &AsciiSet = &CONTROLS.add(b' ').add(b'"').add(b'<').add(b'>').add(b'`');
/// https://url.spec.whatwg.org/#path-percent-encode-set
const PATH: &AsciiSet = &FRAGMENT.add(b'#').add(b'?').add(b'{').add(b'}');
/// https://url.spec.whatwg.org/#userinfo-percent-encode-set
pub const USERINFO: &AsciiSet = &PATH
.add(b'/')
.add(b':')
.add(b';')
.add(b'=')
.add(b'@')
.add(b'[')
.add(b'\\')
.add(b']')
.add(b'^')
.add(b'|');
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
enum CookieStr { enum CookieStr {
/// An string derived from indexes (start, end). /// An string derived from indexes (start, end).
@ -910,8 +929,8 @@ pub struct EncodedCookie<'a, 'c: 'a>(&'a Cookie<'c>);
impl<'a, 'c: 'a> fmt::Display for EncodedCookie<'a, 'c> { impl<'a, 'c: 'a> fmt::Display for EncodedCookie<'a, 'c> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// Percent-encode the name and value. // Percent-encode the name and value.
let name = percent_encode(self.0.name().as_bytes(), USERINFO_ENCODE_SET); let name = percent_encode(self.0.name().as_bytes(), USERINFO);
let value = percent_encode(self.0.value().as_bytes(), USERINFO_ENCODE_SET); let value = percent_encode(self.0.value().as_bytes(), USERINFO);
// Write out the name/value pair and the cookie's parameters. // Write out the name/value pair and the cookie's parameters.
write!(f, "{}={}", name, value)?; write!(f, "{}={}", name, value)?;

View file

@ -6,6 +6,7 @@ use std::{fmt, str::FromStr};
use bytes::{Bytes, BytesMut}; use bytes::{Bytes, BytesMut};
use http::Error as HttpError; use http::Error as HttpError;
use mime::Mime; use mime::Mime;
use percent_encoding::{AsciiSet, CONTROLS};
pub use http::header::*; pub use http::header::*;
@ -361,10 +362,8 @@ pub fn parse_extended_value(
impl fmt::Display for ExtendedValue { impl fmt::Display for ExtendedValue {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let encoded_value = percent_encoding::percent_encode( let encoded_value =
&self.value[..], percent_encoding::percent_encode(&self.value[..], HTTP_VALUE);
self::percent_encoding_http::HTTP_VALUE,
);
if let Some(ref lang) = self.language_tag { if let Some(ref lang) = self.language_tag {
write!(f, "{}'{}'{}", self.charset, lang, encoded_value) write!(f, "{}'{}'{}", self.charset, lang, encoded_value)
} else { } else {
@ -378,8 +377,7 @@ impl fmt::Display for ExtendedValue {
/// ///
/// [url]: https://tools.ietf.org/html/rfc5987#section-3.2 /// [url]: https://tools.ietf.org/html/rfc5987#section-3.2
pub fn http_percent_encode(f: &mut fmt::Formatter, bytes: &[u8]) -> fmt::Result { pub fn http_percent_encode(f: &mut fmt::Formatter, bytes: &[u8]) -> fmt::Result {
let encoded = let encoded = percent_encoding::percent_encode(bytes, HTTP_VALUE);
percent_encoding::percent_encode(bytes, self::percent_encoding_http::HTTP_VALUE);
fmt::Display::fmt(&encoded, f) fmt::Display::fmt(&encoded, f)
} }
@ -394,20 +392,29 @@ impl From<http::HeaderMap> for HeaderMap {
} }
} }
mod percent_encoding_http { // This encode set is used for HTTP header values and is defined at
use percent_encoding::{self, define_encode_set}; // https://tools.ietf.org/html/rfc5987#section-3.2
pub(crate) const HTTP_VALUE: &AsciiSet = &CONTROLS
// internal module because macro is hard-coded to make a public item .add(b' ')
// but we don't want to public export this item .add(b'"')
define_encode_set! { .add(b'%')
// This encode set is used for HTTP header values and is defined at .add(b'\'')
// https://tools.ietf.org/html/rfc5987#section-3.2 .add(b'(')
pub HTTP_VALUE = [percent_encoding::SIMPLE_ENCODE_SET] | { .add(b')')
' ', '"', '%', '\'', '(', ')', '*', ',', '/', ':', ';', '<', '-', '>', '?', .add(b'*')
'[', '\\', ']', '{', '}' .add(b',')
} .add(b'/')
} .add(b':')
} .add(b';')
.add(b'<')
.add(b'-')
.add(b'>')
.add(b'?')
.add(b'[')
.add(b'\\')
.add(b']')
.add(b'{')
.add(b'}');
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {

View file

@ -9,9 +9,9 @@ use bytes::{Buf, Bytes, BytesMut};
use futures::{Async, Poll}; use futures::{Async, Poll};
use http::header::{self, HeaderName, HeaderValue}; use http::header::{self, HeaderName, HeaderValue};
use http::{HttpTryFrom, Method, Uri, Version}; use http::{HttpTryFrom, Method, Uri, Version};
use percent_encoding::{percent_encode, USERINFO_ENCODE_SET}; use percent_encoding::percent_encode;
use crate::cookie::{Cookie, CookieJar}; use crate::cookie::{Cookie, CookieJar, USERINFO};
use crate::header::HeaderMap; use crate::header::HeaderMap;
use crate::header::{Header, IntoHeaderValue}; use crate::header::{Header, IntoHeaderValue};
use crate::payload::Payload; use crate::payload::Payload;
@ -166,8 +166,8 @@ impl TestRequest {
let mut cookie = String::new(); let mut cookie = String::new();
for c in inner.cookies.delta() { for c in inner.cookies.delta() {
let name = percent_encode(c.name().as_bytes(), USERINFO_ENCODE_SET); let name = percent_encode(c.name().as_bytes(), USERINFO);
let value = percent_encode(c.value().as_bytes(), USERINFO_ENCODE_SET); let value = percent_encode(c.value().as_bytes(), USERINFO);
let _ = write!(&mut cookie, "; {}={}", name, value); let _ = write!(&mut cookie, "; {}={}", name, value);
} }
if !cookie.is_empty() { if !cookie.is_empty() {

View file

@ -1,5 +1,14 @@
# Changes # Changes
## [0.2.4] - 2019-xx-xx
### Changed
* Update percent-encoding to "2.1"
* Update serde_urlencoded to "0.6.1"
## [0.2.3] - 2019-08-01 ## [0.2.3] - 2019-08-01
### Added ### Added

View file

@ -51,11 +51,11 @@ derive_more = "0.15.0"
futures = "0.1.25" futures = "0.1.25"
log =" 0.4" log =" 0.4"
mime = "0.3" mime = "0.3"
percent-encoding = "1.0" percent-encoding = "2.1"
rand = "0.7" rand = "0.7"
serde = "1.0" serde = "1.0"
serde_json = "1.0" serde_json = "1.0"
serde_urlencoded = "0.5.3" serde_urlencoded = "0.6.1"
tokio-timer = "0.2.8" tokio-timer = "0.2.8"
openssl = { version="0.10", optional = true } openssl = { version="0.10", optional = true }
rustls = { version = "0.15.2", optional = true } rustls = { version = "0.15.2", optional = true }

View file

@ -7,13 +7,13 @@ use std::{fmt, net};
use bytes::{BufMut, Bytes, BytesMut}; use bytes::{BufMut, Bytes, BytesMut};
use futures::future::{err, Either}; use futures::future::{err, Either};
use futures::{Future, Stream}; use futures::{Future, Stream};
use percent_encoding::{percent_encode, USERINFO_ENCODE_SET}; use percent_encoding::percent_encode;
use serde::Serialize; use serde::Serialize;
use serde_json; use serde_json;
use tokio_timer::Timeout; use tokio_timer::Timeout;
use actix_http::body::{Body, BodyStream}; use actix_http::body::{Body, BodyStream};
use actix_http::cookie::{Cookie, CookieJar}; use actix_http::cookie::{Cookie, CookieJar, USERINFO};
use actix_http::encoding::Decoder; use actix_http::encoding::Decoder;
use actix_http::http::header::{self, ContentEncoding, Header, IntoHeaderValue}; use actix_http::http::header::{self, ContentEncoding, Header, IntoHeaderValue};
use actix_http::http::{ use actix_http::http::{
@ -399,8 +399,8 @@ impl ClientRequest {
if let Some(ref mut jar) = self.cookies { if let Some(ref mut jar) = self.cookies {
let mut cookie = String::new(); let mut cookie = String::new();
for c in jar.delta() { for c in jar.delta() {
let name = percent_encode(c.name().as_bytes(), USERINFO_ENCODE_SET); let name = percent_encode(c.name().as_bytes(), USERINFO);
let value = percent_encode(c.value().as_bytes(), USERINFO_ENCODE_SET); let value = percent_encode(c.value().as_bytes(), USERINFO);
let _ = write!(&mut cookie, "; {}={}", name, value); let _ = write!(&mut cookie, "; {}={}", name, value);
} }
self.head.headers.insert( self.head.headers.insert(

View file

@ -1,12 +1,12 @@
//! Test helpers for actix http client to use during testing. //! Test helpers for actix http client to use during testing.
use std::fmt::Write as FmtWrite; use std::fmt::Write as FmtWrite;
use actix_http::cookie::{Cookie, CookieJar}; use actix_http::cookie::{Cookie, CookieJar, USERINFO};
use actix_http::http::header::{self, Header, HeaderValue, IntoHeaderValue}; use actix_http::http::header::{self, Header, HeaderValue, IntoHeaderValue};
use actix_http::http::{HeaderName, HttpTryFrom, StatusCode, Version}; use actix_http::http::{HeaderName, HttpTryFrom, StatusCode, Version};
use actix_http::{h1, Payload, ResponseHead}; use actix_http::{h1, Payload, ResponseHead};
use bytes::Bytes; use bytes::Bytes;
use percent_encoding::{percent_encode, USERINFO_ENCODE_SET}; use percent_encoding::percent_encode;
use crate::ClientResponse; use crate::ClientResponse;
@ -87,8 +87,8 @@ impl TestResponse {
let mut cookie = String::new(); let mut cookie = String::new();
for c in self.cookies.delta() { for c in self.cookies.delta() {
let name = percent_encode(c.name().as_bytes(), USERINFO_ENCODE_SET); let name = percent_encode(c.name().as_bytes(), USERINFO);
let value = percent_encode(c.value().as_bytes(), USERINFO_ENCODE_SET); let value = percent_encode(c.value().as_bytes(), USERINFO);
let _ = write!(&mut cookie, "; {}={}", name, value); let _ = write!(&mut cookie, "; {}={}", name, value);
} }
if !cookie.is_empty() { if !cookie.is_empty() {

View file

@ -8,9 +8,10 @@ use actix_codec::Framed;
use actix_http::cookie::{Cookie, CookieJar}; use actix_http::cookie::{Cookie, CookieJar};
use actix_http::{ws, Payload, RequestHead}; use actix_http::{ws, Payload, RequestHead};
use futures::future::{err, Either, Future}; use futures::future::{err, Either, Future};
use percent_encoding::{percent_encode, USERINFO_ENCODE_SET}; use percent_encoding::percent_encode;
use tokio_timer::Timeout; use tokio_timer::Timeout;
use actix_http::cookie::USERINFO;
pub use actix_http::ws::{CloseCode, CloseReason, Codec, Frame, Message}; pub use actix_http::ws::{CloseCode, CloseReason, Codec, Frame, Message};
use crate::connect::BoxedSocket; use crate::connect::BoxedSocket;
@ -236,8 +237,8 @@ impl WebsocketsRequest {
if let Some(ref mut jar) = self.cookies { if let Some(ref mut jar) = self.cookies {
let mut cookie = String::new(); let mut cookie = String::new();
for c in jar.delta() { for c in jar.delta() {
let name = percent_encode(c.name().as_bytes(), USERINFO_ENCODE_SET); let name = percent_encode(c.name().as_bytes(), USERINFO);
let value = percent_encode(c.value().as_bytes(), USERINFO_ENCODE_SET); let value = percent_encode(c.value().as_bytes(), USERINFO);
let _ = write!(&mut cookie, "; {}={}", name, value); let _ = write!(&mut cookie, "; {}={}", name, value);
} }
self.head.headers.insert( self.head.headers.insert(

View file

@ -1,5 +1,11 @@
# Changes # Changes
### Changed
* Update serde_urlencoded to "0.6.1"
## [0.2.4] - 2019-07-18 ## [0.2.4] - 2019-07-18
* Update actix-server to 0.6 * Update actix-server to 0.6

View file

@ -49,7 +49,7 @@ serde = "1.0"
serde_json = "1.0" serde_json = "1.0"
sha1 = "0.6" sha1 = "0.6"
slab = "0.4" slab = "0.4"
serde_urlencoded = "0.5.3" serde_urlencoded = "0.6.1"
time = "0.1" time = "0.1"
tokio-tcp = "0.1" tokio-tcp = "0.1"
tokio-timer = "0.2" tokio-timer = "0.2"