mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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>
This commit is contained in:
parent
270df6e263
commit
76e0a1872b
25 changed files with 1342 additions and 1050 deletions
|
@ -16,9 +16,7 @@ use net_traits::{NetworkError, ResourceFetchTiming};
|
|||
use tokio::sync::mpsc::unbounded_channel;
|
||||
|
||||
use crate::fetch::methods::{Data, DoneChannel, FetchContext};
|
||||
use crate::protocols::{
|
||||
get_range_request_bounds, partial_content, range_not_satisfiable_error, ProtocolHandler,
|
||||
};
|
||||
use crate::protocols::{partial_content, range_not_satisfiable_error, ProtocolHandler};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct BlobProtocolHander {}
|
||||
|
@ -42,9 +40,6 @@ impl ProtocolHandler for BlobProtocolHander {
|
|||
|
||||
let range_header = request.headers.typed_get::<Range>();
|
||||
let is_range_request = range_header.is_some();
|
||||
// We will get a final version of this range once we have
|
||||
// the length of the data backing the blob.
|
||||
let range = get_range_request_bounds(range_header);
|
||||
|
||||
let (id, origin) = match parse_blob_url(&url) {
|
||||
Ok((id, origin)) => (id, origin),
|
||||
|
@ -73,7 +68,7 @@ impl ProtocolHandler for BlobProtocolHander {
|
|||
&context.file_token,
|
||||
origin,
|
||||
&mut response,
|
||||
range,
|
||||
range_header,
|
||||
) {
|
||||
let _ = done_sender.send(Data::Done);
|
||||
let err = match err {
|
||||
|
|
|
@ -58,7 +58,9 @@ impl ProtocolHandler for FileProtocolHander {
|
|||
|
||||
let range_header = request.headers.typed_get::<Range>();
|
||||
let is_range_request = range_header.is_some();
|
||||
let Ok(range) = get_range_request_bounds(range_header).get_final(file_size) else {
|
||||
let Ok(range) = get_range_request_bounds(range_header, file_size.unwrap_or(0))
|
||||
.get_final(file_size)
|
||||
else {
|
||||
range_not_satisfiable_error(&mut response);
|
||||
return Box::pin(ready(response));
|
||||
};
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue