1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 01:32:57 +01: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.
* Update serde_urlencoded to "0.6.1"
## [1.0.5] - 2019-07-18

View File

@ -96,7 +96,7 @@ parking_lot = "0.9"
regex = "1.0"
serde = { version = "1.0", features=["derive"] }
serde_json = "1.0"
serde_urlencoded = "0.5.3"
serde_urlencoded = "0.6.1"
time = "0.1.42"
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 `percent-encoding` crate version to 2.1
## [0.1.4] - 2019-07-20
* Allow to disable `Content-Disposition` header #686

View File

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

View File

@ -23,7 +23,7 @@ use futures::future::{ok, Either, FutureResult};
use futures::{Async, Future, Poll, Stream};
use mime;
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;
mod error;
@ -144,7 +144,7 @@ impl Directory {
// show file url as relative to static path
macro_rules! encode_file_url {
($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
* Update percent-encoding to 2.1
* Update serde_urlencoded to 0.6.1
### Fixed
* 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"
log = "0.4"
mime = "0.3"
percent-encoding = "1.0"
percent-encoding = "2.1"
rand = "0.7"
regex = "1.0"
serde = "1.0"
serde_json = "1.0"
sha1 = "0.6"
slab = "0.4"
serde_urlencoded = "0.5.5"
serde_urlencoded = "0.6.1"
time = "0.1.42"
tokio-tcp = "0.1.3"
tokio-timer = "0.2.8"

View File

@ -66,7 +66,7 @@ use std::fmt;
use std::str::FromStr;
use chrono::Duration;
use percent_encoding::{percent_encode, USERINFO_ENCODE_SET};
use percent_encoding::{percent_encode, AsciiSet, CONTROLS};
use time::Tm;
pub use self::builder::CookieBuilder;
@ -75,6 +75,25 @@ pub use self::jar::{CookieJar, Delta, Iter};
use self::parse::parse_cookie;
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)]
enum CookieStr {
/// 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> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// Percent-encode the name and value.
let name = percent_encode(self.0.name().as_bytes(), USERINFO_ENCODE_SET);
let value = percent_encode(self.0.value().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);
// Write out the name/value pair and the cookie's parameters.
write!(f, "{}={}", name, value)?;

View File

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

View File

@ -9,9 +9,9 @@ use bytes::{Buf, Bytes, BytesMut};
use futures::{Async, Poll};
use http::header::{self, HeaderName, HeaderValue};
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::{Header, IntoHeaderValue};
use crate::payload::Payload;
@ -166,8 +166,8 @@ impl TestRequest {
let mut cookie = String::new();
for c in inner.cookies.delta() {
let name = percent_encode(c.name().as_bytes(), USERINFO_ENCODE_SET);
let value = percent_encode(c.value().as_bytes(), USERINFO_ENCODE_SET);
let name = percent_encode(c.name().as_bytes(), USERINFO);
let value = percent_encode(c.value().as_bytes(), USERINFO);
let _ = write!(&mut cookie, "; {}={}", name, value);
}
if !cookie.is_empty() {

View File

@ -1,5 +1,14 @@
# 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
### Added

View File

@ -51,11 +51,11 @@ derive_more = "0.15.0"
futures = "0.1.25"
log =" 0.4"
mime = "0.3"
percent-encoding = "1.0"
percent-encoding = "2.1"
rand = "0.7"
serde = "1.0"
serde_json = "1.0"
serde_urlencoded = "0.5.3"
serde_urlencoded = "0.6.1"
tokio-timer = "0.2.8"
openssl = { version="0.10", 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 futures::future::{err, Either};
use futures::{Future, Stream};
use percent_encoding::{percent_encode, USERINFO_ENCODE_SET};
use percent_encoding::percent_encode;
use serde::Serialize;
use serde_json;
use tokio_timer::Timeout;
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::http::header::{self, ContentEncoding, Header, IntoHeaderValue};
use actix_http::http::{
@ -399,8 +399,8 @@ impl ClientRequest {
if let Some(ref mut jar) = self.cookies {
let mut cookie = String::new();
for c in jar.delta() {
let name = percent_encode(c.name().as_bytes(), USERINFO_ENCODE_SET);
let value = percent_encode(c.value().as_bytes(), USERINFO_ENCODE_SET);
let name = percent_encode(c.name().as_bytes(), USERINFO);
let value = percent_encode(c.value().as_bytes(), USERINFO);
let _ = write!(&mut cookie, "; {}={}", name, value);
}
self.head.headers.insert(

View File

@ -1,12 +1,12 @@
//! Test helpers for actix http client to use during testing.
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::{HeaderName, HttpTryFrom, StatusCode, Version};
use actix_http::{h1, Payload, ResponseHead};
use bytes::Bytes;
use percent_encoding::{percent_encode, USERINFO_ENCODE_SET};
use percent_encoding::percent_encode;
use crate::ClientResponse;
@ -87,8 +87,8 @@ impl TestResponse {
let mut cookie = String::new();
for c in self.cookies.delta() {
let name = percent_encode(c.name().as_bytes(), USERINFO_ENCODE_SET);
let value = percent_encode(c.value().as_bytes(), USERINFO_ENCODE_SET);
let name = percent_encode(c.name().as_bytes(), USERINFO);
let value = percent_encode(c.value().as_bytes(), USERINFO);
let _ = write!(&mut cookie, "; {}={}", name, value);
}
if !cookie.is_empty() {

View File

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

View File

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

View File

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