mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +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
|
@ -11,7 +11,7 @@ use std::sync::atomic::{self, AtomicBool, AtomicUsize, Ordering};
|
|||
use std::sync::{Arc, Mutex, RwLock, Weak};
|
||||
|
||||
use embedder_traits::{EmbedderMsg, EmbedderProxy, FilterPattern};
|
||||
use headers::{ContentLength, ContentType, HeaderMap, HeaderMapExt};
|
||||
use headers::{ContentLength, ContentType, HeaderMap, HeaderMapExt, Range};
|
||||
use http::header::{self, HeaderValue};
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use log::warn;
|
||||
|
@ -30,6 +30,7 @@ use url::Url;
|
|||
use uuid::Uuid;
|
||||
|
||||
use crate::fetch::methods::{CancellationListener, Data, RangeRequestBounds};
|
||||
use crate::protocols::get_range_request_bounds;
|
||||
use crate::resource_thread::CoreResourceThreadPool;
|
||||
|
||||
pub const FILE_CHUNK_SIZE: usize = 32768; //32 KB
|
||||
|
@ -132,7 +133,7 @@ impl FileManager {
|
|||
file_token: &FileTokenCheck,
|
||||
origin: FileOrigin,
|
||||
response: &mut Response,
|
||||
range: RangeRequestBounds,
|
||||
range: Option<Range>,
|
||||
) -> Result<(), BlobURLStoreError> {
|
||||
self.fetch_blob_buf(
|
||||
done_sender,
|
||||
|
@ -140,7 +141,7 @@ impl FileManager {
|
|||
&id,
|
||||
file_token,
|
||||
&origin,
|
||||
range,
|
||||
BlobBounds::Unresolved(range),
|
||||
response,
|
||||
)
|
||||
}
|
||||
|
@ -285,13 +286,17 @@ impl FileManager {
|
|||
id: &Uuid,
|
||||
file_token: &FileTokenCheck,
|
||||
origin_in: &FileOrigin,
|
||||
range: RangeRequestBounds,
|
||||
bounds: BlobBounds,
|
||||
response: &mut Response,
|
||||
) -> Result<(), BlobURLStoreError> {
|
||||
let file_impl = self.store.get_impl(id, file_token, origin_in)?;
|
||||
match file_impl {
|
||||
FileImpl::Memory(buf) => {
|
||||
let range = range
|
||||
let bounds = match bounds {
|
||||
BlobBounds::Unresolved(range) => get_range_request_bounds(range, buf.size),
|
||||
BlobBounds::Resolved(bounds) => bounds,
|
||||
};
|
||||
let range = bounds
|
||||
.get_final(Some(buf.size))
|
||||
.map_err(|_| BlobURLStoreError::InvalidRange)?;
|
||||
|
||||
|
@ -323,7 +328,11 @@ impl FileManager {
|
|||
let file = File::open(&metadata.path)
|
||||
.map_err(|e| BlobURLStoreError::External(e.to_string()))?;
|
||||
|
||||
let range = range
|
||||
let bounds = match bounds {
|
||||
BlobBounds::Unresolved(range) => get_range_request_bounds(range, metadata.size),
|
||||
BlobBounds::Resolved(bounds) => bounds,
|
||||
};
|
||||
let range = bounds
|
||||
.get_final(Some(metadata.size))
|
||||
.map_err(|_| BlobURLStoreError::InvalidRange)?;
|
||||
|
||||
|
@ -362,15 +371,16 @@ impl FileManager {
|
|||
FileImpl::Sliced(parent_id, inner_rel_pos) => {
|
||||
// Next time we don't need to check validity since
|
||||
// we have already done that for requesting URL if necessary.
|
||||
let bounds = RangeRequestBounds::Final(
|
||||
RelativePos::full_range().slice_inner(&inner_rel_pos),
|
||||
);
|
||||
self.fetch_blob_buf(
|
||||
done_sender,
|
||||
cancellation_listener,
|
||||
&parent_id,
|
||||
file_token,
|
||||
origin_in,
|
||||
RangeRequestBounds::Final(
|
||||
RelativePos::full_range().slice_inner(&inner_rel_pos),
|
||||
),
|
||||
BlobBounds::Resolved(bounds),
|
||||
response,
|
||||
)
|
||||
},
|
||||
|
@ -378,6 +388,11 @@ impl FileManager {
|
|||
}
|
||||
}
|
||||
|
||||
enum BlobBounds {
|
||||
Unresolved(Option<Range>),
|
||||
Resolved(RangeRequestBounds),
|
||||
}
|
||||
|
||||
/// File manager's data store. It maintains a thread-safe mapping
|
||||
/// from FileID to FileStoreEntry which might have different backend implementation.
|
||||
/// Access to the content is encapsulated as methods of this struct.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue