Skip to content

Commit 00efb8f

Browse files
committed
Merge branch 'main' into no_std
2 parents 316c868 + 54346fa commit 00efb8f

File tree

24 files changed

+310
-142
lines changed

24 files changed

+310
-142
lines changed

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: "docker"
9+
directory: "/"
10+
schedule:
11+
interval: "monthly"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "monthly"

.github/workflows/codecov.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ name: Coverage
22

33
on:
44
push:
5-
branches: ["master"]
5+
branches: ["main"]
66
pull_request:
77

88
jobs:
99
coverage:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
- uses: dtolnay/rust-toolchain@stable
1414
- uses: taiki-e/install-action@v2
1515
with:
1616
tool: cargo-tarpaulin
1717
- run: cargo tarpaulin --out Xml
18-
- uses: codecov/codecov-action@v3
18+
- uses: codecov/codecov-action@v4
1919
# A codecov token is not needed for public repos if the repo is linked
2020
# on codecov.io. See https://docs.codecov.com/docs/frequently-asked-questions#where-is-the-repository-upload-token-found
21-
- uses: actions/upload-artifact@v2
21+
- uses: actions/upload-artifact@v4
2222
with:
2323
name: code-coverage-report
2424
path: cobertura.xml

.github/workflows/main.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
push:
5-
branches: ["master"]
5+
branches: ["main"]
66
pull_request:
77
merge_group:
88
types: [checks_requested]
@@ -31,7 +31,7 @@ jobs:
3131
runs-on: ${{ matrix.os }}
3232

3333
steps:
34-
- uses: actions/checkout@v3
34+
- uses: actions/checkout@v4
3535
- uses: dtolnay/rust-toolchain@master
3636
with:
3737
toolchain: ${{ matrix.rust }}
@@ -70,16 +70,20 @@ jobs:
7070
WASM:
7171
runs-on: ubuntu-latest
7272
steps:
73-
- uses: actions/checkout@v3
73+
- uses: actions/checkout@v4
7474
- uses: dtolnay/rust-toolchain@stable
7575
with:
7676
targets: wasm32-unknown-unknown
77+
- name: Install wasm-pack
78+
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
7779
- run: cargo build --target wasm32-unknown-unknown
80+
- run: cd url && wasm-pack test --headless --chrome
81+
- run: cd url && wasm-pack test --headless --firefox
7882

7983
Lint:
8084
runs-on: ubuntu-latest
8185
steps:
82-
- uses: actions/checkout@v3
86+
- uses: actions/checkout@v4
8387
- uses: dtolnay/rust-toolchain@stable
8488
with:
8589
components: rustfmt, clippy
@@ -90,7 +94,7 @@ jobs:
9094
Audit:
9195
runs-on: ubuntu-latest
9296
steps:
93-
- uses: actions/checkout@v3
97+
- uses: actions/checkout@v4
9498
- uses: EmbarkStudios/cargo-deny-action@v1
9599

96100
Result:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ rust-url
99

1010
URL library for Rust, based on the [URL Standard](https://url.spec.whatwg.org/).
1111

12-
[Documentation](https://docs.rs/url/)
12+
[Documentation](https://docs.rs/url)
1313

14-
Please see [UPGRADING.md](https://github.com/servo/rust-url/blob/master/UPGRADING.md) if you are upgrading from a previous version.
14+
Please see [UPGRADING.md](https://github.com/servo/rust-url/blob/main/UPGRADING.md) if you are upgrading from a previous version.

data-url/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ alloc = []
1717

1818
[dev-dependencies]
1919
tester = "0.9"
20+
unicode-width = "=0.1.12"
2021
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
2122
serde_json = "1.0"
2223

data-url/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ where
298298
// before this special byte
299299
if i > slice_start {
300300
write_bytes(&bytes[slice_start..i])?;
301+
slice_start = i;
301302
}
302303
// Then deal with the special byte.
303304
match byte {

data-url/tests/data-urls.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@
5252
["data:text/plain;Charset=UTF-8,%C2%B1",
5353
"text/plain;charset=UTF-8",
5454
[194, 177]],
55+
["data:text/plain,%",
56+
"text/plain",
57+
[37]],
58+
["data:text/plain,X%",
59+
"text/plain",
60+
[88, 37]],
61+
["data:text/plain,X%%",
62+
"text/plain",
63+
[88, 37, 37]],
64+
["data:text/plain;Charset=UTF-8,X%X",
65+
"text/plain;charset=UTF-8",
66+
[88, 37, 88]],
67+
["data:text/plain;Charset=UTF-8,X%0",
68+
"text/plain;charset=UTF-8",
69+
[88, 37, 48]],
70+
["data:text/plain;Charset=UTF-8,X%0X",
71+
"text/plain;charset=UTF-8",
72+
[88, 37, 48, 88]],
5573
["data:text/plain;charset=windows-1252,áñçə💩",
5674
"text/plain;charset=windows-1252",
5775
[195, 161, 195, 177, 195, 167, 201, 153, 240, 159, 146, 169]],

form_urlencoded/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ pub(crate) fn encode<'a>(encoding_override: EncodingOverride<'_>, input: &'a str
396396
input.as_bytes().into()
397397
}
398398

399+
// std::ptr::addr_eq was stabilized in rust 1.76. Once we upgrade
400+
// the MSRV we can remove this lint override.
401+
#[allow(ambiguous_wide_pointer_comparisons)]
399402
pub(crate) fn decode_utf8_lossy(input: Cow<'_, [u8]>) -> Cow<'_, str> {
400403
// Note: This function is duplicated in `percent_encoding/lib.rs`.
401404
match input {

idna/benches/all.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ fn to_unicode_puny_label(bench: &mut Bencher) {
1111
bench.iter(|| config.to_unicode(black_box(encoded)));
1212
}
1313

14+
fn to_ascii_already_puny_label(bench: &mut Bencher) {
15+
let encoded = "abc.xn--mgbcm";
16+
let config = Config::default();
17+
bench.iter(|| config.to_ascii(black_box(encoded)));
18+
}
19+
1420
fn to_unicode_ascii(bench: &mut Bencher) {
1521
let encoded = "example.com";
1622
let config = Config::default();
@@ -47,6 +53,7 @@ benchmark_group!(
4753
to_unicode_ascii,
4854
to_unicode_merged_label,
4955
to_ascii_puny_label,
56+
to_ascii_already_puny_label,
5057
to_ascii_simple,
5158
to_ascii_merged,
5259
);

idna/src/punycode.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
1616
use alloc::{string::String, vec::Vec};
1717
use core::char;
18-
use core::u32;
1918

2019
// Bootstring parameters for Punycode
2120
static BASE: u32 = 36;
@@ -41,10 +40,12 @@ fn adapt(mut delta: u32, num_points: u32, first_time: bool) -> u32 {
4140

4241
/// Convert Punycode to an Unicode `String`.
4342
///
44-
/// This is a convenience wrapper around `decode`.
43+
/// Return None on malformed input or overflow.
44+
/// Overflow can only happen on inputs that take more than
45+
/// 63 encoded bytes, the DNS limit on domain name labels.
4546
#[inline]
4647
pub fn decode_to_string(input: &str) -> Option<String> {
47-
decode(input).map(|chars| chars.into_iter().collect())
48+
Some(Decoder::default().decode(input).ok()?.collect())
4849
}
4950

5051
/// Convert Punycode to Unicode.
@@ -110,7 +111,7 @@ impl Decoder {
110111
if digit > (u32::MAX - i) / weight {
111112
return Err(()); // Overflow
112113
}
113-
i += digit * weight;
114+
i = i.checked_add(digit * weight).ok_or(())?;
114115
let t = if k <= bias {
115116
T_MIN
116117
} else if k >= bias + T_MAX {

0 commit comments

Comments
 (0)