mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update rustfmt to the 2024 style edition (#35764)
* Use 2024 style edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reformat all code Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
6300e820b4
commit
3d320fa96a
603 changed files with 1739 additions and 1648 deletions
|
@ -6,15 +6,15 @@ use std::collections::hash_map::HashMap;
|
|||
use std::convert::TryFrom;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use futures::task::{Context, Poll};
|
||||
use futures::Future;
|
||||
use futures::task::{Context, Poll};
|
||||
use http::uri::{Authority, Uri as Destination};
|
||||
use http_body_util::combinators::BoxBody;
|
||||
use hyper::body::Bytes;
|
||||
use hyper::rt::Executor;
|
||||
use hyper_rustls::HttpsConnector as HyperRustlsHttpsConnector;
|
||||
use hyper_util::client::legacy::connect::HttpConnector as HyperHttpConnector;
|
||||
use hyper_util::client::legacy::Client;
|
||||
use hyper_util::client::legacy::connect::HttpConnector as HyperHttpConnector;
|
||||
use log::warn;
|
||||
use rustls::client::WebPkiServerVerifier;
|
||||
use rustls::{ClientConfig, RootCertStore};
|
||||
|
|
|
@ -10,8 +10,8 @@ use std::net::{Ipv4Addr, Ipv6Addr};
|
|||
use std::time::SystemTime;
|
||||
|
||||
use cookie::Cookie;
|
||||
use net_traits::pub_domains::is_pub_domain;
|
||||
use net_traits::CookieSource;
|
||||
use net_traits::pub_domains::is_pub_domain;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
//! <http://tools.ietf.org/html/rfc6265>
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::time::SystemTime;
|
||||
|
||||
use log::{debug, info};
|
||||
use net_traits::pub_domains::reg_suffix;
|
||||
use net_traits::CookieSource;
|
||||
use net_traits::pub_domains::reg_suffix;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ use futures::{Future, Stream};
|
|||
use futures_util::StreamExt;
|
||||
use headers::{ContentLength, HeaderMapExt};
|
||||
use http_body_util::BodyExt;
|
||||
use hyper::body::Body;
|
||||
use hyper::header::{HeaderValue, CONTENT_ENCODING, TRANSFER_ENCODING};
|
||||
use hyper::Response;
|
||||
use hyper::body::Body;
|
||||
use hyper::header::{CONTENT_ENCODING, HeaderValue, TRANSFER_ENCODING};
|
||||
use tokio_util::codec::{BytesCodec, FramedRead};
|
||||
use tokio_util::io::StreamReader;
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use http::header::HeaderName;
|
||||
use http::Method;
|
||||
use http::header::HeaderName;
|
||||
use net_traits::request::{CredentialsMode, Origin, Request};
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
|||
use std::sync::{Arc, Mutex};
|
||||
use std::{io, mem, str};
|
||||
|
||||
use base64::engine::general_purpose;
|
||||
use base64::Engine as _;
|
||||
use base64::engine::general_purpose;
|
||||
use content_security_policy as csp;
|
||||
use crossbeam_channel::Sender;
|
||||
use devtools_traits::DevtoolsControlMsg;
|
||||
|
@ -22,14 +22,14 @@ use net_traits::filemanager_thread::{FileTokenCheck, RelativePos};
|
|||
use net_traits::http_status::HttpStatus;
|
||||
use net_traits::policy_container::{PolicyContainer, RequestPolicyContainer};
|
||||
use net_traits::request::{
|
||||
is_cors_safelisted_method, is_cors_safelisted_request_header, BodyChunkRequest,
|
||||
BodyChunkResponse, CredentialsMode, Destination, Initiator, InsecureRequestsPolicy, Origin,
|
||||
RedirectMode, Referrer, Request, RequestMode, ResponseTainting, Window,
|
||||
BodyChunkRequest, BodyChunkResponse, CredentialsMode, Destination, Initiator,
|
||||
InsecureRequestsPolicy, Origin, RedirectMode, Referrer, Request, RequestMode, ResponseTainting,
|
||||
Window, is_cors_safelisted_method, is_cors_safelisted_request_header,
|
||||
};
|
||||
use net_traits::response::{Response, ResponseBody, ResponseType};
|
||||
use net_traits::{
|
||||
set_default_accept_language, FetchTaskTarget, NetworkError, ReferrerPolicy, ResourceAttribute,
|
||||
ResourceFetchTiming, ResourceTimeValue, ResourceTimingType,
|
||||
FetchTaskTarget, NetworkError, ReferrerPolicy, ResourceAttribute, ResourceFetchTiming,
|
||||
ResourceTimeValue, ResourceTimingType, set_default_accept_language,
|
||||
};
|
||||
use rustls_pki_types::CertificateDer;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -41,7 +41,7 @@ use super::fetch_params::FetchParams;
|
|||
use crate::fetch::cors_cache::CorsCache;
|
||||
use crate::fetch::headers::determine_nosniff;
|
||||
use crate::filemanager_thread::FileManager;
|
||||
use crate::http_loader::{determine_requests_referrer, http_fetch, set_default_accept, HttpState};
|
||||
use crate::http_loader::{HttpState, determine_requests_referrer, http_fetch, set_default_accept};
|
||||
use crate::protocols::ProtocolRegistry;
|
||||
use crate::request_interceptor::RequestInterceptor;
|
||||
use crate::subresource_integrity::is_response_integrity_valid;
|
||||
|
|
|
@ -11,8 +11,8 @@ use embedder_traits::resources::{self, Resource};
|
|||
use headers::{HeaderMapExt, StrictTransportSecurity};
|
||||
use http::HeaderMap;
|
||||
use log::{error, info};
|
||||
use net_traits::pub_domains::reg_suffix;
|
||||
use net_traits::IncludeSubdomains;
|
||||
use net_traits::pub_domains::reg_suffix;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use servo_config::pref;
|
||||
use servo_url::{Host, ServoUrl};
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
|
||||
use std::collections::HashMap;
|
||||
use std::ops::Bound;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Mutex;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::time::{Duration, Instant, SystemTime};
|
||||
|
||||
use headers::{
|
||||
CacheControl, ContentRange, Expires, HeaderMapExt, LastModified, Pragma, Range, Vary,
|
||||
};
|
||||
use http::header::HeaderValue;
|
||||
use http::{header, HeaderMap, Method, StatusCode};
|
||||
use http::{HeaderMap, Method, StatusCode, header};
|
||||
use log::debug;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps, MallocUnconditionalSizeOf};
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
|
@ -28,7 +28,7 @@ use net_traits::{FetchMetadata, Metadata, ResourceFetchTiming};
|
|||
use servo_arc::Arc;
|
||||
use servo_config::pref;
|
||||
use servo_url::ServoUrl;
|
||||
use tokio::sync::mpsc::{unbounded_channel as unbounded, UnboundedSender as TokioSender};
|
||||
use tokio::sync::mpsc::{UnboundedSender as TokioSender, unbounded_channel as unbounded};
|
||||
|
||||
use crate::fetch::methods::{Data, DoneChannel};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ use devtools_traits::{
|
|||
HttpResponse as DevtoolsHttpResponse, NetworkEvent,
|
||||
};
|
||||
use embedder_traits::{AuthenticationResponse, EmbedderMsg, EmbedderProxy};
|
||||
use futures::{future, TryFutureExt, TryStreamExt};
|
||||
use futures::{TryFutureExt, TryStreamExt, future};
|
||||
use headers::authorization::Basic;
|
||||
use headers::{
|
||||
AccessControlAllowCredentials, AccessControlAllowHeaders, AccessControlAllowMethods,
|
||||
|
@ -25,16 +25,16 @@ use headers::{
|
|||
IfModifiedSince, LastModified, Pragma, Referer, UserAgent,
|
||||
};
|
||||
use http::header::{
|
||||
self, HeaderValue, ACCEPT, AUTHORIZATION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LOCATION,
|
||||
CONTENT_TYPE,
|
||||
self, ACCEPT, AUTHORIZATION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LOCATION,
|
||||
CONTENT_TYPE, HeaderValue,
|
||||
};
|
||||
use http::{HeaderMap, Method, Request as HyperRequest, StatusCode};
|
||||
use http_body_util::combinators::BoxBody;
|
||||
use http_body_util::{BodyExt, Full};
|
||||
use hyper::Response as HyperResponse;
|
||||
use hyper::body::{Bytes, Frame};
|
||||
use hyper::ext::ReasonPhrase;
|
||||
use hyper::header::{HeaderName, TRANSFER_ENCODING};
|
||||
use hyper::Response as HyperResponse;
|
||||
use hyper_serde::Serde;
|
||||
use hyper_util::client::legacy::Client;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
|
@ -44,23 +44,22 @@ use net_traits::http_status::HttpStatus;
|
|||
use net_traits::pub_domains::reg_suffix;
|
||||
use net_traits::request::Origin::Origin as SpecificOrigin;
|
||||
use net_traits::request::{
|
||||
get_cors_unsafe_header_names, is_cors_non_wildcard_request_header_name,
|
||||
is_cors_safelisted_method, is_cors_safelisted_request_header, BodyChunkRequest,
|
||||
BodyChunkResponse, CacheMode, CredentialsMode, Destination, Initiator, Origin, RedirectMode,
|
||||
Referrer, Request, RequestBuilder, RequestMode, ResponseTainting, ServiceWorkersMode,
|
||||
Window as RequestWindow,
|
||||
BodyChunkRequest, BodyChunkResponse, CacheMode, CredentialsMode, Destination, Initiator,
|
||||
Origin, RedirectMode, Referrer, Request, RequestBuilder, RequestMode, ResponseTainting,
|
||||
ServiceWorkersMode, Window as RequestWindow, get_cors_unsafe_header_names,
|
||||
is_cors_non_wildcard_request_header_name, is_cors_safelisted_method,
|
||||
is_cors_safelisted_request_header,
|
||||
};
|
||||
use net_traits::response::{HttpsState, Response, ResponseBody, ResponseType};
|
||||
use net_traits::{
|
||||
CookieSource, FetchMetadata, NetworkError, RedirectEndValue, RedirectStartValue,
|
||||
ReferrerPolicy, ResourceAttribute, ResourceFetchTiming, ResourceTimeValue,
|
||||
DOCUMENT_ACCEPT_HEADER_VALUE,
|
||||
CookieSource, DOCUMENT_ACCEPT_HEADER_VALUE, FetchMetadata, NetworkError, RedirectEndValue,
|
||||
RedirectStartValue, ReferrerPolicy, ResourceAttribute, ResourceFetchTiming, ResourceTimeValue,
|
||||
};
|
||||
use servo_arc::Arc;
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use tokio::sync::mpsc::{
|
||||
channel, unbounded_channel, Receiver as TokioReceiver, Sender as TokioSender,
|
||||
UnboundedReceiver, UnboundedSender,
|
||||
Receiver as TokioReceiver, Sender as TokioSender, UnboundedReceiver, UnboundedSender, channel,
|
||||
unbounded_channel,
|
||||
};
|
||||
use tokio_stream::wrappers::ReceiverStream;
|
||||
|
||||
|
@ -72,7 +71,7 @@ use crate::decoder::Decoder;
|
|||
use crate::fetch::cors_cache::CorsCache;
|
||||
use crate::fetch::fetch_params::FetchParams;
|
||||
use crate::fetch::headers::{SecFetchDest, SecFetchMode, SecFetchSite, SecFetchUser};
|
||||
use crate::fetch::methods::{main_fetch, Data, DoneChannel, FetchContext, Target};
|
||||
use crate::fetch::methods::{Data, DoneChannel, FetchContext, Target, main_fetch};
|
||||
use crate::hsts::HstsList;
|
||||
use crate::http_cache::{CacheKey, HttpCache};
|
||||
use crate::resource_thread::{AuthCache, AuthCacheEntry};
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::{mem, thread};
|
||||
|
||||
|
@ -16,7 +16,7 @@ use net_traits::image_cache::{
|
|||
};
|
||||
use net_traits::request::CorsSettings;
|
||||
use net_traits::{FetchMetadata, FetchResponseMsg, FilteredMetadata, NetworkError};
|
||||
use pixels::{load_from_memory, CorsStatus, Image, ImageMetadata, PixelFormat};
|
||||
use pixels::{CorsStatus, Image, ImageMetadata, PixelFormat, load_from_memory};
|
||||
use servo_config::pref;
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use webrender_api::units::DeviceIntSize;
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::fs::{DirEntry, Metadata, ReadDir};
|
|||
use std::path::PathBuf;
|
||||
|
||||
use chrono::{DateTime, Local};
|
||||
use embedder_traits::resources::{read_string, Resource};
|
||||
use embedder_traits::resources::{Resource, read_string};
|
||||
use headers::{ContentType, HeaderMapExt};
|
||||
use net_traits::request::Request;
|
||||
use net_traits::response::{Response, ResponseBody};
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::future::{ready, Future};
|
||||
use std::future::{Future, ready};
|
||||
use std::pin::Pin;
|
||||
|
||||
use headers::{HeaderMapExt, Range};
|
||||
use http::Method;
|
||||
use log::debug;
|
||||
use net_traits::blob_url_store::{parse_blob_url, BlobURLStoreError};
|
||||
use net_traits::blob_url_store::{BlobURLStoreError, parse_blob_url};
|
||||
use net_traits::http_status::HttpStatus;
|
||||
use net_traits::request::Request;
|
||||
use net_traits::response::{Response, ResponseBody};
|
||||
|
@ -16,7 +16,7 @@ use net_traits::{NetworkError, ResourceFetchTiming};
|
|||
use tokio::sync::mpsc::unbounded_channel;
|
||||
|
||||
use crate::fetch::methods::{Data, DoneChannel, FetchContext};
|
||||
use crate::protocols::{partial_content, range_not_satisfiable_error, ProtocolHandler};
|
||||
use crate::protocols::{ProtocolHandler, partial_content, range_not_satisfiable_error};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct BlobProtocolHander {}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::fs::File;
|
||||
use std::future::{ready, Future};
|
||||
use std::future::{Future, ready};
|
||||
use std::io::{BufReader, Seek, SeekFrom};
|
||||
use std::pin::Pin;
|
||||
|
||||
|
@ -18,7 +18,7 @@ use crate::fetch::methods::{DoneChannel, FetchContext};
|
|||
use crate::filemanager_thread::FILE_CHUNK_SIZE;
|
||||
use crate::local_directory_listing;
|
||||
use crate::protocols::{
|
||||
get_range_request_bounds, partial_content, range_not_satisfiable_error, ProtocolHandler,
|
||||
ProtocolHandler, get_range_request_bounds, partial_content, range_not_satisfiable_error,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::future::Future;
|
||||
use std::ops::Bound;
|
||||
use std::pin::Pin;
|
||||
|
|
|
@ -6,10 +6,10 @@ use content_security_policy::Destination;
|
|||
use embedder_traits::{EmbedderMsg, EmbedderProxy, WebResourceRequest, WebResourceResponseMsg};
|
||||
use ipc_channel::ipc;
|
||||
use log::error;
|
||||
use net_traits::NetworkError;
|
||||
use net_traits::http_status::HttpStatus;
|
||||
use net_traits::request::Request;
|
||||
use net_traits::response::{Response, ResponseBody};
|
||||
use net_traits::NetworkError;
|
||||
|
||||
use crate::fetch::methods::FetchContext;
|
||||
|
||||
|
|
|
@ -42,17 +42,17 @@ use servo_url::{ImmutableOrigin, ServoUrl};
|
|||
|
||||
use crate::async_runtime::HANDLE;
|
||||
use crate::connector::{
|
||||
create_http_client, create_tls_config, CACertificates, CertificateErrorOverrideManager,
|
||||
CACertificates, CertificateErrorOverrideManager, create_http_client, create_tls_config,
|
||||
};
|
||||
use crate::cookie::ServoCookie;
|
||||
use crate::cookie_storage::CookieStorage;
|
||||
use crate::fetch::cors_cache::CorsCache;
|
||||
use crate::fetch::fetch_params::FetchParams;
|
||||
use crate::fetch::methods::{fetch, CancellationListener, FetchContext};
|
||||
use crate::fetch::methods::{CancellationListener, FetchContext, fetch};
|
||||
use crate::filemanager_thread::FileManager;
|
||||
use crate::hsts::HstsList;
|
||||
use crate::http_cache::HttpCache;
|
||||
use crate::http_loader::{http_redirect_fetch, HttpState};
|
||||
use crate::http_loader::{HttpState, http_redirect_fetch};
|
||||
use crate::protocols::ProtocolRegistry;
|
||||
use crate::request_interceptor::RequestInterceptor;
|
||||
use crate::storage_thread::StorageThreadFactory;
|
||||
|
@ -676,7 +676,10 @@ impl CoreResourceThreadPool {
|
|||
|
||||
if still_active == 0 || rounds == 10 {
|
||||
if still_active > 0 {
|
||||
debug!("Exiting CoreResourceThreadPool with {:?} still working(should be zero)", still_active);
|
||||
debug!(
|
||||
"Exiting CoreResourceThreadPool with {:?} still working(should be zero)",
|
||||
still_active
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use std::sync::{Arc, Mutex, Weak};
|
|||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use base::id::TEST_PIPELINE_ID;
|
||||
use crossbeam_channel::{unbounded, Sender};
|
||||
use crossbeam_channel::{Sender, unbounded};
|
||||
use devtools_traits::{HttpRequest as DevtoolsHttpRequest, HttpResponse as DevtoolsHttpResponse};
|
||||
use headers::{
|
||||
AccessControlAllowCredentials, AccessControlAllowHeaders, AccessControlAllowMethods,
|
||||
|
@ -48,9 +48,9 @@ use uuid::Uuid;
|
|||
|
||||
use crate::http_loader::{expect_devtools_http_request, expect_devtools_http_response};
|
||||
use crate::{
|
||||
create_embedder_proxy, create_embedder_proxy_and_receiver, create_http_state, fetch,
|
||||
fetch_with_context, fetch_with_cors_cache, make_body, make_server, make_ssl_server,
|
||||
new_fetch_context, DEFAULT_USER_AGENT,
|
||||
DEFAULT_USER_AGENT, create_embedder_proxy, create_embedder_proxy_and_receiver,
|
||||
create_http_state, fetch, fetch_with_context, fetch_with_cors_cache, make_body, make_server,
|
||||
make_ssl_server, new_fetch_context,
|
||||
};
|
||||
|
||||
// TODO write a struct that impls Handler for storing test values
|
||||
|
@ -298,19 +298,25 @@ fn test_cors_preflight_fetch() {
|
|||
if request.method() == Method::OPTIONS &&
|
||||
state.clone().fetch_add(1, Ordering::SeqCst) == 0
|
||||
{
|
||||
assert!(request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD));
|
||||
assert!(!request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS));
|
||||
assert!(!request
|
||||
.headers()
|
||||
.get(header::REFERER)
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.contains("a.html"));
|
||||
assert!(
|
||||
request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)
|
||||
);
|
||||
assert!(
|
||||
!request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)
|
||||
);
|
||||
assert!(
|
||||
!request
|
||||
.headers()
|
||||
.get(header::REFERER)
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.contains("a.html")
|
||||
);
|
||||
response
|
||||
.headers_mut()
|
||||
.typed_insert(AccessControlAllowOrigin::ANY);
|
||||
|
@ -356,12 +362,16 @@ fn test_cors_preflight_cache_fetch() {
|
|||
if request.method() == Method::OPTIONS &&
|
||||
state.clone().fetch_add(1, Ordering::SeqCst) == 0
|
||||
{
|
||||
assert!(request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD));
|
||||
assert!(!request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS));
|
||||
assert!(
|
||||
request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)
|
||||
);
|
||||
assert!(
|
||||
!request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)
|
||||
);
|
||||
response
|
||||
.headers_mut()
|
||||
.typed_insert(AccessControlAllowOrigin::ANY);
|
||||
|
@ -424,12 +434,16 @@ fn test_cors_preflight_fetch_network_error() {
|
|||
if request.method() == Method::OPTIONS &&
|
||||
state.clone().fetch_add(1, Ordering::SeqCst) == 0
|
||||
{
|
||||
assert!(request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD));
|
||||
assert!(!request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS));
|
||||
assert!(
|
||||
request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)
|
||||
);
|
||||
assert!(
|
||||
!request
|
||||
.headers()
|
||||
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)
|
||||
);
|
||||
response
|
||||
.headers_mut()
|
||||
.typed_insert(AccessControlAllowOrigin::ANY);
|
||||
|
@ -488,9 +502,11 @@ fn test_fetch_response_is_basic_filtered() {
|
|||
|
||||
let headers = fetch_response.headers;
|
||||
assert!(!headers.contains_key(header::SET_COOKIE));
|
||||
assert!(headers
|
||||
.get(HeaderName::from_static("set-cookie2"))
|
||||
.is_none());
|
||||
assert!(
|
||||
headers
|
||||
.get(HeaderName::from_static("set-cookie2"))
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -560,9 +576,11 @@ fn test_fetch_response_is_cors_filtered() {
|
|||
|
||||
assert!(!headers.contains_key(header::ACCESS_CONTROL_ALLOW_ORIGIN));
|
||||
assert!(!headers.contains_key(header::SET_COOKIE));
|
||||
assert!(headers
|
||||
.get(HeaderName::from_static("set-cookie2"))
|
||||
.is_none());
|
||||
assert!(
|
||||
headers
|
||||
.get(HeaderName::from_static("set-cookie2"))
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -794,18 +812,22 @@ fn test_load_adds_host_to_hsts_list_when_url_is_https() {
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(context
|
||||
.state
|
||||
.hsts_list
|
||||
.read()
|
||||
.unwrap()
|
||||
.is_host_secure(url.host_str().unwrap()));
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
assert!(
|
||||
context
|
||||
.state
|
||||
.hsts_list
|
||||
.read()
|
||||
.unwrap()
|
||||
.is_host_secure(url.host_str().unwrap())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -106,12 +106,14 @@ fn test_push_entry_with_0_max_age_evicts_entry_from_list() {
|
|||
let mut entries_map = HashMap::new();
|
||||
entries_map.insert(
|
||||
"mozilla.org".to_owned(),
|
||||
vec![HstsEntry::new(
|
||||
"mozilla.org".to_owned(),
|
||||
IncludeSubdomains::NotIncluded,
|
||||
Some(StdDuration::from_secs(500000)),
|
||||
)
|
||||
.unwrap()],
|
||||
vec![
|
||||
HstsEntry::new(
|
||||
"mozilla.org".to_owned(),
|
||||
IncludeSubdomains::NotIncluded,
|
||||
Some(StdDuration::from_secs(500000)),
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
);
|
||||
let mut list = HstsList {
|
||||
entries_map: entries_map,
|
||||
|
@ -182,12 +184,14 @@ fn test_push_entry_to_hsts_list_should_not_create_duplicate_entry() {
|
|||
let mut entries_map = HashMap::new();
|
||||
entries_map.insert(
|
||||
"mozilla.org".to_owned(),
|
||||
vec![HstsEntry::new(
|
||||
"mozilla.org".to_owned(),
|
||||
IncludeSubdomains::NotIncluded,
|
||||
None,
|
||||
)
|
||||
.unwrap()],
|
||||
vec![
|
||||
HstsEntry::new(
|
||||
"mozilla.org".to_owned(),
|
||||
IncludeSubdomains::NotIncluded,
|
||||
None,
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
);
|
||||
let mut list = HstsList {
|
||||
entries_map: entries_map,
|
||||
|
@ -286,12 +290,14 @@ fn test_hsts_list_with_exact_domain_entry_is_is_host_secure() {
|
|||
let mut entries_map = HashMap::new();
|
||||
entries_map.insert(
|
||||
"mozilla.org".to_owned(),
|
||||
vec![HstsEntry::new(
|
||||
"mozilla.org".to_owned(),
|
||||
IncludeSubdomains::NotIncluded,
|
||||
None,
|
||||
)
|
||||
.unwrap()],
|
||||
vec![
|
||||
HstsEntry::new(
|
||||
"mozilla.org".to_owned(),
|
||||
IncludeSubdomains::NotIncluded,
|
||||
None,
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
);
|
||||
|
||||
let hsts_list = HstsList {
|
||||
|
@ -320,12 +326,14 @@ fn test_hsts_list_with_subdomain_when_include_subdomains_is_false_is_not_is_host
|
|||
let mut entries_map = HashMap::new();
|
||||
entries_map.insert(
|
||||
"mozilla.org".to_owned(),
|
||||
vec![HstsEntry::new(
|
||||
"mozilla.org".to_owned(),
|
||||
IncludeSubdomains::NotIncluded,
|
||||
None,
|
||||
)
|
||||
.unwrap()],
|
||||
vec![
|
||||
HstsEntry::new(
|
||||
"mozilla.org".to_owned(),
|
||||
IncludeSubdomains::NotIncluded,
|
||||
None,
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
);
|
||||
let hsts_list = HstsList {
|
||||
entries_map: entries_map,
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use base::id::TEST_PIPELINE_ID;
|
||||
use http::header::{HeaderValue, EXPIRES};
|
||||
use http::StatusCode;
|
||||
use http::header::{EXPIRES, HeaderValue};
|
||||
use net::http_cache::HttpCache;
|
||||
use net_traits::request::{Referrer, RequestBuilder};
|
||||
use net_traits::response::{Response, ResponseBody};
|
||||
|
|
|
@ -12,14 +12,14 @@ use std::time::Duration;
|
|||
|
||||
use base::id::{TEST_PIPELINE_ID, TEST_WEBVIEW_ID};
|
||||
use cookie::Cookie as CookiePair;
|
||||
use crossbeam_channel::{unbounded, Receiver};
|
||||
use crossbeam_channel::{Receiver, unbounded};
|
||||
use devtools_traits::{
|
||||
ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest,
|
||||
HttpResponse as DevtoolsHttpResponse, NetworkEvent,
|
||||
};
|
||||
use embedder_traits::AuthenticationResponse;
|
||||
use flate2::write::{GzEncoder, ZlibEncoder};
|
||||
use flate2::Compression;
|
||||
use flate2::write::{GzEncoder, ZlibEncoder};
|
||||
use headers::authorization::Basic;
|
||||
use headers::{
|
||||
Authorization, ContentLength, Date, HeaderMapExt, Host, StrictTransportSecurity, UserAgent,
|
||||
|
@ -37,7 +37,7 @@ use net::cookie_storage::CookieStorage;
|
|||
use net::fetch::methods::{self};
|
||||
use net::http_loader::{determine_requests_referrer, serialize_origin};
|
||||
use net::resource_thread::AuthCacheEntry;
|
||||
use net::test::{replace_host_table, DECODER_BUFFER_SIZE};
|
||||
use net::test::{DECODER_BUFFER_SIZE, replace_host_table};
|
||||
use net_traits::http_status::HttpStatus;
|
||||
use net_traits::request::{
|
||||
BodyChunkRequest, BodyChunkResponse, BodySource, CredentialsMode, Destination, Referrer,
|
||||
|
@ -184,12 +184,14 @@ fn test_check_default_headers_loaded_in_every_request() {
|
|||
.build();
|
||||
|
||||
let response = dbg!(fetch(request, None));
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
|
||||
// Testing for method.POST
|
||||
let mut post_headers = headers.clone();
|
||||
|
@ -210,19 +212,21 @@ fn test_check_default_headers_loaded_in_every_request() {
|
|||
.build();
|
||||
|
||||
let response = fetch(request, None);
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
|
||||
let _ = server.close();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_load_when_request_is_not_get_or_head_and_there_is_no_body_content_length_should_be_set_to_0(
|
||||
) {
|
||||
fn test_load_when_request_is_not_get_or_head_and_there_is_no_body_content_length_should_be_set_to_0()
|
||||
{
|
||||
let handler = move |request: HyperRequest<Incoming>,
|
||||
_: &mut HyperResponse<BoxBody<Bytes, hyper::Error>>| {
|
||||
assert_eq!(
|
||||
|
@ -241,12 +245,14 @@ fn test_load_when_request_is_not_get_or_head_and_there_is_no_body_content_length
|
|||
.build();
|
||||
|
||||
let response = fetch(request, None);
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
|
||||
let _ = server.close();
|
||||
}
|
||||
|
@ -276,12 +282,14 @@ fn test_request_and_response_data_with_network_messages() {
|
|||
|
||||
let (devtools_chan, devtools_port) = unbounded();
|
||||
let response = fetch(request, Some(devtools_chan));
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
|
||||
let _ = server.close();
|
||||
|
||||
|
@ -487,8 +495,8 @@ fn test_load_when_redirecting_from_a_post_should_rewrite_next_request_as_get() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_load_should_decode_the_response_as_deflate_when_response_headers_have_content_encoding_deflate(
|
||||
) {
|
||||
fn test_load_should_decode_the_response_as_deflate_when_response_headers_have_content_encoding_deflate()
|
||||
{
|
||||
let handler =
|
||||
move |_: HyperRequest<Incoming>,
|
||||
response: &mut HyperResponse<BoxBody<Bytes, hyper::Error>>| {
|
||||
|
@ -628,12 +636,14 @@ fn test_load_doesnt_add_host_to_hsts_list_when_url_is_http_even_if_hsts_headers_
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
assert_eq!(
|
||||
context
|
||||
.state
|
||||
|
@ -675,12 +685,14 @@ fn test_load_sets_cookies_in_the_resource_manager_when_it_get_set_cookie_header_
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
|
||||
assert_cookie_for_domain(
|
||||
&context.state.cookie_jar,
|
||||
|
@ -728,12 +740,14 @@ fn test_load_sets_requests_cookies_header_for_url_by_getting_cookies_from_the_re
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -775,12 +789,14 @@ fn test_load_sends_cookie_if_nonhttp() {
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -814,12 +830,14 @@ fn test_cookie_set_with_httponly_should_not_be_available_using_getcookiesforurl(
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
|
||||
assert_cookie_for_domain(
|
||||
&context.state.cookie_jar,
|
||||
|
@ -827,9 +845,11 @@ fn test_cookie_set_with_httponly_should_not_be_available_using_getcookiesforurl(
|
|||
Some("mozillaIs=theBest"),
|
||||
);
|
||||
let mut cookie_jar = context.state.cookie_jar.write().unwrap();
|
||||
assert!(cookie_jar
|
||||
.cookies_for_url(&url, CookieSource::NonHTTP)
|
||||
.is_none());
|
||||
assert!(
|
||||
cookie_jar
|
||||
.cookies_for_url(&url, CookieSource::NonHTTP)
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -897,12 +917,14 @@ fn test_load_sets_content_length_to_length_of_request_body() {
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -937,12 +959,14 @@ fn test_load_uses_explicit_accept_from_headers_in_load_data() {
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -974,12 +998,14 @@ fn test_load_sets_default_accept_to_html_xhtml_xml_and_then_anything_else() {
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1014,12 +1040,14 @@ fn test_load_uses_explicit_accept_encoding_from_load_data_headers() {
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1051,12 +1079,14 @@ fn test_load_sets_default_accept_encoding_to_gzip_and_deflate() {
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1397,12 +1427,14 @@ fn test_if_auth_creds_not_in_url_but_in_cache_it_sets_it() {
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1593,12 +1625,14 @@ fn test_user_credentials_prompt_when_proxy_authentication_is_required() {
|
|||
|
||||
let _ = server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1643,12 +1677,14 @@ fn test_prompt_credentials_when_client_receives_unauthorized_response() {
|
|||
|
||||
server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_success()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1687,12 +1723,14 @@ fn test_prompt_credentials_user_cancels_dialog_input() {
|
|||
|
||||
server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_client_error());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_client_error()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1737,12 +1775,14 @@ fn test_prompt_credentials_user_input_incorrect_credentials() {
|
|||
|
||||
server.close();
|
||||
|
||||
assert!(response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_client_error());
|
||||
assert!(
|
||||
response
|
||||
.internal_response
|
||||
.unwrap()
|
||||
.status
|
||||
.code()
|
||||
.is_client_error()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -26,7 +26,7 @@ use std::net::TcpListener as StdTcpListener;
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, LazyLock, Mutex, RwLock, Weak};
|
||||
|
||||
use crossbeam_channel::{unbounded, Receiver, Sender};
|
||||
use crossbeam_channel::{Receiver, Sender, unbounded};
|
||||
use devtools_traits::DevtoolsControlMsg;
|
||||
use embedder_traits::{AuthenticationResponse, EmbedderMsg, EmbedderProxy, EventLoopWaker};
|
||||
use futures::future::ready;
|
||||
|
@ -127,15 +127,17 @@ fn receive_credential_prompt_msgs(
|
|||
embedder_receiver: Receiver<EmbedderMsg>,
|
||||
response: Option<AuthenticationResponse>,
|
||||
) -> std::thread::JoinHandle<()> {
|
||||
std::thread::spawn(move || loop {
|
||||
let embedder_msg = embedder_receiver.recv().unwrap();
|
||||
match embedder_msg {
|
||||
embedder_traits::EmbedderMsg::RequestAuthentication(_, _, _, response_sender) => {
|
||||
let _ = response_sender.send(response);
|
||||
break;
|
||||
},
|
||||
embedder_traits::EmbedderMsg::WebResourceRequested(..) => {},
|
||||
_ => unreachable!(),
|
||||
std::thread::spawn(move || {
|
||||
loop {
|
||||
let embedder_msg = embedder_receiver.recv().unwrap();
|
||||
match embedder_msg {
|
||||
embedder_traits::EmbedderMsg::RequestAuthentication(_, _, _, response_sender) => {
|
||||
let _ = response_sender.send(response);
|
||||
break;
|
||||
},
|
||||
embedder_traits::EmbedderMsg::WebResourceRequested(..) => {},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use net::subresource_integrity::{
|
||||
get_prioritized_hash_function, get_strongest_metadata, is_response_integrity_valid,
|
||||
parsed_metadata, SriEntry,
|
||||
SriEntry, get_prioritized_hash_function, get_strongest_metadata, is_response_integrity_valid,
|
||||
parsed_metadata,
|
||||
};
|
||||
use net_traits::response::{Response, ResponseBody};
|
||||
use net_traits::{ResourceFetchTiming, ResourceTimingType};
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
//! over events from the network and events from the DOM, using async/await to avoid
|
||||
//! the need for a dedicated thread per websocket.
|
||||
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use async_tungstenite::tokio::{client_async_tls_with_connector_and_config, ConnectStream};
|
||||
use async_tungstenite::WebSocketStream;
|
||||
use async_tungstenite::tokio::{ConnectStream, client_async_tls_with_connector_and_config};
|
||||
use base64::Engine;
|
||||
use futures::future::TryFutureExt;
|
||||
use futures::stream::StreamExt;
|
||||
|
@ -28,16 +28,16 @@ use net_traits::{CookieSource, MessageData, WebSocketDomAction, WebSocketNetwork
|
|||
use servo_url::ServoUrl;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::select;
|
||||
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver};
|
||||
use tokio::sync::mpsc::{UnboundedReceiver, unbounded_channel};
|
||||
use tokio_rustls::TlsConnector;
|
||||
use tungstenite::Message;
|
||||
use tungstenite::error::{Error, ProtocolError, Result as WebSocketResult, UrlError};
|
||||
use tungstenite::handshake::client::{Request, Response};
|
||||
use tungstenite::protocol::CloseFrame;
|
||||
use tungstenite::Message;
|
||||
use url::Url;
|
||||
|
||||
use crate::async_runtime::HANDLE;
|
||||
use crate::connector::{create_tls_config, CACertificates, TlsConfig};
|
||||
use crate::connector::{CACertificates, TlsConfig, create_tls_config};
|
||||
use crate::cookie::ServoCookie;
|
||||
use crate::fetch::methods::should_request_be_blocked_due_to_a_bad_port;
|
||||
use crate::hosts::replace_host;
|
||||
|
@ -358,7 +358,7 @@ fn connect(
|
|||
return Err(
|
||||
"Received a RequestBuilder with a non-websocket mode in websocket_loader"
|
||||
.to_string(),
|
||||
)
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue