Commit graph

1365 commits

Author SHA1 Message Date
Dominik Maier ebd5cfbf6f
no_stdsupport for the url crate (#831) 2024-10-17 19:41:59 +00:00
Hans Larsen 7eccac9a0b
Add a test for and fix issue #974 (#975)
* Add a test for issue 974

* Fix the issue

* rename test
2024-09-30 06:41:54 +00:00
Josh McKinney 710e1e7da0
refactor and add tests for percent encoding (#977)
* refactor: move AsciiSet related code to ascii_set.rs

Makes it a little easier to just look at the code related to the set rather than encoding

* Add tests for percent_encoding
2024-09-27 00:13:20 +00:00
Manish Goregaokar 6050a6e001
mention why we pin unicode-width (#972) 2024-09-19 17:17:52 +00:00
Josh McKinney 55055658ab
Add AsciiSet::EMPTY and boolean operators (#969)
* Add AsciiSet::EMPTY and impl ops::Add for AsciiSet

In RFCs, the sets of characters to percent-encode are often defined as
the union of multiple sets. This change adds an `EMPTY` constant to
`AsciiSet` and implements the `Add` trait for `AsciiSet` so that sets
can be combined with the `+` operator.

AsciiSet now derives `Debug`, `PartialEq`, and `Eq` so that it can be
used in tests.

* implement ops::Not for AsciiSet

* Add const functions for negation / union of AsciiSet
2024-09-19 07:18:15 +00:00
Valentin Gosu 9404ff53a0
Mark debugger_visualizer as optional and fix clippy (#967) 2024-09-16 18:05:36 +00:00
Colin Watson 22b823708a
Fix idna tests with no_std (#963)
This failed since 464b1f7d8f:

  (cd idna && cargo test --all-targets --no-default-features --features alloc -- --ignored)
2024-09-16 07:31:42 +00:00
Brooks Townsend c04aca3f74
fix: enable wasip2 feature for wasm32-wasip2 target (#960)
Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>
2024-09-13 21:48:34 +00:00
Valentin Gosu 54346fa288
Revert "Reimplement idna on top of ICU4X" (#946)
* Revert "Reimplement idna on top of ICU4X (#923)"

This reverts commit 3d6dbbb1df.

See #937 for reasons behind this backout.

* Bump url version to 2.5.2

* Pin unicode-width to 0.1.12 to avoid build failure in rust 1.56

* Remove ambiguous_wide_pointer_comparisons to maybe resolve clippy error

* fix clippy
2024-06-18 19:53:12 +00:00
Valentin Gosu dcfbed3e90
Update idna to 1.0.1 (#945) 2024-06-18 18:08:13 +00:00
Sebastian Thiel 467ef63969
fix panic on xn--55555577 (#940)
* reproduce a panic when parsing a specific URL

Details can be found here: https://github.com/Byron/gitoxide/issues/1401

* fix overflow when processing punycode encoded URLs like `xn--55555577`

* fix clippy error
2024-06-18 07:16:28 +00:00
Henri Sivonen 3d6dbbb1df
Reimplement idna on top of ICU4X (#923)
* Reimplement idna on top of ICU4X

* Add an even faster lower-case ASCII letter path to avoid regressing performance

* Comments and verify_dns_length tweak

* Parametrize internal vs. external Punycode caller; restore external API behavior

* Add bench for to_ascii on an already-Punycode name

* Avoid re-encoding Punycode when possible

* Pass through the input slice in many more cases

* Add testing for the simultaneous mode

* Omit the invalid domain character check on the url side

* Document that Punycode labels must result in non-ASCII

* Rename files called uts46.rs to deprecated.rs

* Rename uts46bis to uts46

* Tweak docs

* Avoid useless copying and useless UTF-8 decode

* Use inline(never) to optimize binary size

* Split CheckHyphens into a separate concern form the ASCII deny list

* Make the ASCII deny list customizable

* Better docs and top-level functions

* Parameter for VerifyDNSLength

* Restore support for transitional processing to minimize breakage

* In the deprecated API, use empty deny list with use_std3_ascii_rules=false

* Tweak docs

* Docs, rename AsciiDenyList::WHATWG to ::URL, tweak top-level functions

* Use idna crate top-level function in the url crate to dogfood the top-level function

* Add an Usage section to the README

* Add an early return to map_transitional for readability

* Document internal vs. external Punycode caller differences

* Per discussion with Valentin, revert deprecated API to the old behavior that does not check hyphens in positions 3 and 4

* Add comments about not fixing deprecated API

* Add a comment explaining FailFast in deprecated.rs

* For future-proofing, add compiled_data cargo feature (currently always required)

Since other changes in this changeset require a semver break anyway, this
change takes a semver break in the case of `default-features = false` in
order to avoid a future semver break if in the future a need to add a
bring-your-own-data (using `icu_provider`) constructor for `Uts46`
shows up.

* Remove remark about spec violation by making root dot permissibility configurable

* Clarify README about IDNA 2003/2008

* Add a historical remark to the README

* Fix typo

* Depend on crates.io versions of icu_normalizer and icu_properties

* Address clippy lints

* Update versions

* Increment dependency versions
2024-06-03 09:44:30 +00:00
Mo de947abf89
Document possible replacements of the base URL (#926) 2024-04-15 16:04:36 +00:00
Aatif Syed 8b8431bbe1
docs: document SyntaxViolation variants, remove bare URLs (#924)
* doc: syntax violation variants

* fix: rustdoc::bare_urls
2024-04-12 10:49:09 +00:00
DylanOToole2 fd042e003f
Non-special URLs can have their paths erased (#921) 2024-04-05 18:37:21 +00:00
micolous 49eea1c2eb
Fix multiple issues on wasm32: (#886)
* remove `Url::socket_addrs` on wasm32-unknown-unknown (it won't work, those
  platform API calls are not supported)

* disable unit tests which won't work on wasm32-unknown-unknown

* run tests in `wasm_bindgen_test` on wasm32-unknown-unknown

* remove `panic::catch_unwind` from wpt tests, as that conflicts with
  wasm-bindgen's panic handler

* run the tests in CI
2024-04-04 08:01:00 +00:00
Valentin Gosu a4dd58be59
Fix lint (#920) 2024-04-02 10:45:47 +00:00
Alex Touchet 73803fa780
Update URLs (#916) 2024-03-22 18:57:49 +00:00
Henri Sivonen 8e4331d260
Add bench for to_ascii on an already-Punycode name (#915) 2024-03-22 10:59:42 +00:00
Martin Robinson 9c51937adb
Rename master branch to main (#914) 2024-03-20 10:32:33 +00:00
Smaug e654efb9c1
Fix non-base64 data URLs with % character not followed by hex digits (#797)
When writing accumulated "non-special" characters, `slice_start` must be
updated as some later conditionals/pattern matches don't update it like
the case when `%` is not followed by 2 hex digits.

This fixes #795
2024-03-04 10:15:08 +00:00
dependabot[bot] 8a1e3e2286
Bump actions/checkout from 3 to 4 (#906)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-12 09:37:11 +00:00
dependabot[bot] 74698b7351
Bump actions/upload-artifact from 2 to 4 (#905)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-12 09:36:26 +00:00
dependabot[bot] 664d17eada
Bump codecov/codecov-action from 3 to 4 (#904)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-12 09:36:01 +00:00
Vasiliy Taranov 11bb12f3e3
Add dependabot (#903) 2024-02-11 21:43:38 +00:00
Valentin Gosu b77a81b2b2
Use SPECIAL_PATH_SEGMENT when encoding path in from_file_path (#902)
* Use SPECIAL_PATH_SEGMENT when encoding path in from_file_path

Fixes #901

* cargo fmt
2024-02-02 19:40:57 +00:00
bishopcheckmate f447500049
perf(punycode): avoid double allocation in decode_to_string (#894)
* perf(punycode): avoid double allocation in decode_to_string

* include decode_to_string in tests
2024-01-10 09:40:48 +00:00
philippeitis 92f356e449
Be more detailed in documentation of set_query (#737)
* Be more detailed in documentation of set_query

* Remove trailing space

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-11-24 11:26:40 +00:00
Valentin Gosu 00e9e18ce6
Update url 2.5.0 (#885)
* Update data-url to 0.3.1

* Update percent_encoding to 2.3.1

* Update form_urlencoded to 1.2.1

* Update idna to 0.5.0

* Update url to 2.5.0
2023-11-22 18:56:54 +00:00
Bennet Bleßmann 464b1f7d8f
Fix another overflow in punycode encode_into (#880)
* add another overflowing test

* fix overflow in case the input has more than u32::MAX characters

* detect hugh length early
2023-11-17 11:01:09 +00:00
sprock 912d716b04
Correct spelling mistake in Position docs (#875)
The sentence in question was clearly intended to remark that the leading
slash in the path is part of said path, but due to the missing "e" at
the end of "Note", it (ungrammatically) says the opposite.

Co-authored-by: Maeve Sproule <code@sprock.dev>
2023-11-10 09:53:46 +00:00
Redfire 5f454e2031
Added #[must_use] Attributes for Configuration Options (#876) 2023-11-09 23:56:24 +00:00
edgul 67fc2730b6
Fix search setting for non-special urls with space, query and fragment (#879) 2023-11-09 15:28:18 +00:00
Bennet Bleßmann ae8d29e04a
use checked addition to not panic in debug build (#877)
* commit always dirty file

* add test to idna for bad punycode

* use checked addition to not panic in debug build
2023-11-08 08:29:28 +00:00
Valentin Gosu e39c9a20be
Fix clippy (#878) 2023-11-07 21:32:21 +00:00
Valentin Gosu a08aa2cd10
Fix panic in set_path for file URLs (#865)
* Fix panic in set_path for file URLs

* New minor version

* Fix clippy lint
2023-08-28 09:42:28 +00:00
Dominik Maier edabc79793
Fix no_std for idna (#843)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-07-17 08:27:58 +00:00
Luca Casonato 115837002b
Update WPT data and expectations (#859) 2023-07-15 16:02:29 +00:00
Luca Casonato beb2cde646
Stabilize debugger_visualizer feature (#855)
* Stabilize debugger_visualizer feature

* Run debugger_visualizer on  more rustc versions
2023-07-14 21:05:57 +00:00
Guillaume Gomez 86730f1653
Add --generate-link-to-definition option when building on docs.rs (#858) 2023-07-14 21:04:30 +00:00
Luca Casonato e4dbb436e6
Implement std::error::Error for InvalidBase64 (#856) 2023-07-14 21:00:31 +00:00
Luca Casonato b33514a3bc
Rewrite WPT runner (#857) 2023-07-14 20:59:35 +00:00
Martin Robinson b22857487a
Enable the GitHub merge queue (#851) 2023-07-12 13:10:20 +00:00
Luca Casonato 3a474c320a
Merge pull request #698 from lucacasonato/impl_error_for_data_url
fix: implement std::error::Error for data-url
2023-07-12 13:42:36 +02:00
Luca Casonato 1f7dbe0df5
Merge pull request #848 from lucacasonato/fix_trailing_space_pathname_setter
Fix trailing spaces in scheme / pathname / search setters
2023-07-12 13:41:29 +02:00
Luca Casonato 63f850bee9
fix: implement std::error::Error for data-url
This commit implements std::error::Error for errors in the `data-url`
crate. This commit does not implement `Error` on `DecodeError` because
there is no trait bound for `Error` on the `E` type argument of
`DecodeError`.
2023-07-12 13:14:36 +02:00
Luca Casonato 4d3e9e9a86
Fix trailing spaces in pathname setters 2023-07-12 13:13:58 +02:00
Valentin Gosu 93b8e2f170
Merge pull request #852 from atouchet/bdg
Remove obsolete badge references
2023-07-12 13:00:16 +02:00
Valentin Gosu 077075be33
Merge pull request #853 from lucacasonato/move_url_debugger_to_separate_crate
Move debugger_visualizer tests to separate crate
2023-07-12 12:58:21 +02:00
Luca Casonato 4b31c13cf7
Move debugger_visualizer tests to separate crate
To prevent having to raise MSRV again, we move the debugger_visualizer
to a separate crate. This crate is only compiled when the feature
`debugger_visualizer` is enabled, because only then the
`debugger_visualizer` test is added as a compile target.
2023-07-12 10:42:10 +02:00