aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/protocols/mod.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2025-01-08 00:47:58 -0500
committerGitHub <noreply@github.com>2025-01-08 05:47:58 +0000
commit76e0a1872baab22a4dfafcdaf431db4fe5864b18 (patch)
tree23119b8b3d8893f328efd492b804418c29ae080d /components/net/protocols/mod.rs
parent270df6e26334149d12c975cb91e6db7e5fa8ccab (diff)
downloadservo-76e0a1872baab22a4dfafcdaf431db4fe5864b18.tar.gz
servo-76e0a1872baab22a4dfafcdaf431db4fe5864b18.zip
Update all network-related dependencies to the latest versions (#34630)
* Update all network-related dependencies to the latest versions: * rustls * hyper * http * headers * tungstenite * async-tungstenite Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix panics with 1xx responses in WPT tests. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Use reported response length when calculating available ranges. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Remove unreachable match arm. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Clean up commented fragments in blob and file handlers. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Remove unreachable match arm. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix clippy warning. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Cleanup. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix up unit tests for dependency upgrades. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update aws-lc-sys to fix Windows builds. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Use ring instead of aws-lc-sys. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * embedding: Require embedder to initialize a rustls CryptoProvider. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Disable aws-lc-rs pending OhOS build fixes. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/net/protocols/mod.rs')
-rw-r--r--components/net/protocols/mod.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/components/net/protocols/mod.rs b/components/net/protocols/mod.rs
index 02b8f65614b..51d43ab9d2a 100644
--- a/components/net/protocols/mod.rs
+++ b/components/net/protocols/mod.rs
@@ -106,19 +106,15 @@ pub fn range_not_satisfiable_error(response: &mut Response) {
}
/// Get the range bounds if the `Range` header is present.
-pub fn get_range_request_bounds(range: Option<Range>) -> RangeRequestBounds {
+pub fn get_range_request_bounds(range: Option<Range>, len: u64) -> RangeRequestBounds {
if let Some(ref range) = range {
- let (start, end) = match range
- .iter()
- .collect::<Vec<(Bound<u64>, Bound<u64>)>>()
- .first()
- {
- Some(&(Bound::Included(start), Bound::Unbounded)) => (start, None),
- Some(&(Bound::Included(start), Bound::Included(end))) => {
+ let (start, end) = match range.satisfiable_ranges(len).next() {
+ Some((Bound::Included(start), Bound::Unbounded)) => (start, None),
+ Some((Bound::Included(start), Bound::Included(end))) => {
// `end` should be less or equal to `start`.
(start, Some(i64::max(start as i64, end as i64)))
},
- Some(&(Bound::Unbounded, Bound::Included(offset))) => {
+ Some((Bound::Unbounded, Bound::Included(offset))) => {
return RangeRequestBounds::Pending(offset);
},
_ => (0, None),