summaryrefslogtreecommitdiffstats
path: root/vendor/url/src
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/url/src')
-rw-r--r--vendor/url/src/lib.rs30
-rw-r--r--vendor/url/src/parser.rs16
-rw-r--r--vendor/url/src/path_segments.rs2
-rw-r--r--vendor/url/src/quirks.rs6
4 files changed, 35 insertions, 19 deletions
diff --git a/vendor/url/src/lib.rs b/vendor/url/src/lib.rs
index ad3c89001..58c7c07cd 100644
--- a/vendor/url/src/lib.rs
+++ b/vendor/url/src/lib.rs
@@ -119,12 +119,24 @@ See [serde documentation](https://serde.rs) for more information.
url = { version = "2", features = ["serde"] }
```
+# Feature: `debugger_visualizer`
+
+If you enable the `debugger_visualizer` feature, the `url` crate will include
+a [natvis file](https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects)
+for [Visual Studio](https://www.visualstudio.com/) that allows you to view
+[`Url`](struct.Url.html) objects in the debugger.
+
+This feature requires Rust 1.71 or later.
+
+```toml
+url = { version = "2", features = ["debugger_visualizer"] }
+```
+
*/
-#![doc(html_root_url = "https://docs.rs/url/2.4.0")]
+#![doc(html_root_url = "https://docs.rs/url/2.4.1")]
#![cfg_attr(
feature = "debugger_visualizer",
- feature(debugger_visualizer),
debugger_visualizer(natvis_file = "../../debug_metadata/url.natvis")
)]
@@ -1486,7 +1498,7 @@ impl Url {
if let Some(input) = fragment {
self.fragment_start = Some(to_u32(self.serialization.len()).unwrap());
self.serialization.push('#');
- self.mutate(|parser| parser.parse_fragment(parser::Input::no_trim(input)))
+ self.mutate(|parser| parser.parse_fragment(parser::Input::new_no_trim(input)))
} else {
self.fragment_start = None;
self.strip_trailing_spaces_from_opaque_path();
@@ -1549,7 +1561,7 @@ impl Url {
parser.parse_query(
scheme_type,
scheme_end,
- parser::Input::trim_tab_and_newlines(input, vfn),
+ parser::Input::new_trim_tab_and_newlines(input, vfn),
)
});
} else {
@@ -1670,10 +1682,14 @@ impl Url {
parser.serialization.push_str("%2F");
path = &path[1..];
}
- parser.parse_cannot_be_a_base_path(parser::Input::new(path));
+ parser.parse_cannot_be_a_base_path(parser::Input::new_no_trim(path));
} else {
let mut has_host = true; // FIXME
- parser.parse_path_start(scheme_type, &mut has_host, parser::Input::new(path));
+ parser.parse_path_start(
+ scheme_type,
+ &mut has_host,
+ parser::Input::new_no_trim(path),
+ );
}
});
self.restore_after_path(old_after_path_pos, &after_path);
@@ -2343,7 +2359,7 @@ impl Url {
#[allow(clippy::result_unit_err, clippy::suspicious_operation_groupings)]
pub fn set_scheme(&mut self, scheme: &str) -> Result<(), ()> {
let mut parser = Parser::for_setter(String::new());
- let remaining = parser.parse_scheme(parser::Input::new(scheme))?;
+ let remaining = parser.parse_scheme(parser::Input::new_no_trim(scheme))?;
let new_scheme_type = SchemeType::from(&parser.serialization);
let old_scheme_type = SchemeType::from(self.scheme());
// If url’s scheme is a special scheme and buffer is not a special scheme, then return.
diff --git a/vendor/url/src/parser.rs b/vendor/url/src/parser.rs
index 765cc027c..7d94d1d71 100644
--- a/vendor/url/src/parser.rs
+++ b/vendor/url/src/parser.rs
@@ -184,17 +184,13 @@ pub struct Input<'i> {
}
impl<'i> Input<'i> {
- pub fn new(input: &'i str) -> Self {
- Input::with_log(input, None)
- }
-
- pub fn no_trim(input: &'i str) -> Self {
+ pub fn new_no_trim(input: &'i str) -> Self {
Input {
chars: input.chars(),
}
}
- pub fn trim_tab_and_newlines(
+ pub fn new_trim_tab_and_newlines(
original_input: &'i str,
vfn: Option<&dyn Fn(SyntaxViolation)>,
) -> Self {
@@ -212,7 +208,10 @@ impl<'i> Input<'i> {
}
}
- pub fn with_log(original_input: &'i str, vfn: Option<&dyn Fn(SyntaxViolation)>) -> Self {
+ pub fn new_trim_c0_control_and_space(
+ original_input: &'i str,
+ vfn: Option<&dyn Fn(SyntaxViolation)>,
+ ) -> Self {
let input = original_input.trim_matches(c0_control_or_space);
if let Some(vfn) = vfn {
if input.len() < original_input.len() {
@@ -362,7 +361,7 @@ impl<'a> Parser<'a> {
/// https://url.spec.whatwg.org/#concept-basic-url-parser
pub fn parse_url(mut self, input: &str) -> ParseResult<Url> {
- let input = Input::with_log(input, self.violation_fn);
+ let input = Input::new_trim_c0_control_and_space(input, self.violation_fn);
if let Ok(remaining) = self.parse_scheme(input.clone()) {
return self.parse_with_scheme(remaining);
}
@@ -1203,6 +1202,7 @@ impl<'a> Parser<'a> {
_ => {
self.check_url_code_point(c, &input);
if scheme_type.is_file()
+ && self.serialization.len() > path_start
&& is_normalized_windows_drive_letter(
&self.serialization[path_start + 1..],
)
diff --git a/vendor/url/src/path_segments.rs b/vendor/url/src/path_segments.rs
index 29afc1e7e..d8a78d785 100644
--- a/vendor/url/src/path_segments.rs
+++ b/vendor/url/src/path_segments.rs
@@ -237,7 +237,7 @@ impl<'a> PathSegmentsMut<'a> {
scheme_type,
&mut has_host,
path_start,
- parser::Input::new(segment),
+ parser::Input::new_no_trim(segment),
);
}
});
diff --git a/vendor/url/src/quirks.rs b/vendor/url/src/quirks.rs
index 0674ebb62..3a99e22cf 100644
--- a/vendor/url/src/quirks.rs
+++ b/vendor/url/src/quirks.rs
@@ -152,7 +152,7 @@ pub fn set_host(url: &mut Url, new_host: &str) -> Result<(), ()> {
}
// Host parsing rules are strict,
// We don't want to trim the input
- let input = Input::no_trim(new_host);
+ let input = Input::new_no_trim(new_host);
let host;
let opt_port;
{
@@ -203,7 +203,7 @@ pub fn set_hostname(url: &mut Url, new_hostname: &str) -> Result<(), ()> {
return Err(());
}
// Host parsing rules are strict we don't want to trim the input
- let input = Input::no_trim(new_hostname);
+ let input = Input::new_no_trim(new_hostname);
let scheme_type = SchemeType::from(url.scheme());
if scheme_type == SchemeType::File && new_hostname.is_empty() {
url.set_host_internal(Host::Domain(String::new()), None);
@@ -249,7 +249,7 @@ pub fn set_port(url: &mut Url, new_port: &str) -> Result<(), ()> {
return Err(());
}
result = Parser::parse_port(
- Input::new(new_port),
+ Input::new_no_trim(new_port),
|| default_port(scheme),
Context::Setter,
)