mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-23 03:50:59 +00:00
Update to url 2.0 where we can
This commit is contained in:
parent
f149f8f1b5
commit
c888094f68
5 changed files with 14 additions and 6 deletions
|
@ -7,7 +7,7 @@ license = "MIT/Apache-2.0"
|
|||
description = "Rust File Plugin"
|
||||
|
||||
[dependencies]
|
||||
url = "1.1"
|
||||
url = "2"
|
||||
glib = { git = "https://github.com/gtk-rs/glib" }
|
||||
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["subclassing"] }
|
||||
gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["subclassing"] }
|
||||
|
|
|
@ -8,7 +8,7 @@ edition = "2018"
|
|||
description = "Rust FLV Plugin"
|
||||
|
||||
[dependencies]
|
||||
url = "1.1"
|
||||
url = "2"
|
||||
glib = { git = "https://github.com/gtk-rs/glib" }
|
||||
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["subclassing"] }
|
||||
gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
|
||||
|
|
|
@ -8,7 +8,7 @@ description = "Rust HTTP Plugin"
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
url = "1.1"
|
||||
url = "1.7"
|
||||
glib = { git = "https://github.com/gtk-rs/glib" }
|
||||
reqwest = "0.9"
|
||||
futures = "0.1.23"
|
||||
|
|
|
@ -15,7 +15,8 @@ gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", fea
|
|||
gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["subclassing", "v1_12"] }
|
||||
rusoto_core = "0.40"
|
||||
rusoto_s3 = "0.40"
|
||||
url = "1.7"
|
||||
url = "2"
|
||||
percent-encoding = "2"
|
||||
tokio = "0.1"
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
use std::str::FromStr;
|
||||
|
||||
use percent_encoding::{percent_decode, percent_encode, AsciiSet, CONTROLS};
|
||||
use rusoto_core::Region;
|
||||
use url::percent_encoding::{percent_decode, percent_encode, DEFAULT_ENCODE_SET};
|
||||
use url::Url;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -20,13 +20,20 @@ pub struct GstS3Url {
|
|||
pub version: Option<String>,
|
||||
}
|
||||
|
||||
// FIXME: Copied from the url crate, see https://github.com/servo/rust-url/issues/529
|
||||
// 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'}');
|
||||
const PATH_SEGMENT: &AsciiSet = &PATH.add(b'/').add(b'%');
|
||||
|
||||
impl ToString for GstS3Url {
|
||||
fn to_string(&self) -> String {
|
||||
format!(
|
||||
"s3://{}/{}/{}{}",
|
||||
self.region.name(),
|
||||
self.bucket,
|
||||
percent_encode(self.object.as_bytes(), DEFAULT_ENCODE_SET),
|
||||
percent_encode(self.object.as_bytes(), PATH_SEGMENT),
|
||||
if self.version.is_some() {
|
||||
format!("?version={}", self.version.clone().unwrap())
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue