Commit c888094f authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Update to url 2.0 where we can

parent f149f8f1
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment