mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
bump base64 from 0.10 to 0.21 (#29804)
* bump base64 from 0.10 to 0.21 * Fix configuration of bitflags --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
ad0fa77456
commit
4c8db6af87
10 changed files with 103 additions and 86 deletions
|
@ -9,6 +9,7 @@ use crate::filemanager_thread::{FileManager, FILE_CHUNK_SIZE};
|
|||
use crate::http_loader::{determine_requests_referrer, http_fetch, HttpState};
|
||||
use crate::http_loader::{set_default_accept, set_default_accept_language};
|
||||
use crate::subresource_integrity::is_response_integrity_valid;
|
||||
use base64::Engine;
|
||||
use content_security_policy as csp;
|
||||
use crossbeam_channel::Sender;
|
||||
use devtools_traits::DevtoolsControlMsg;
|
||||
|
@ -659,7 +660,8 @@ async fn scheme_fetch(
|
|||
if let Some((secret, bytes)) = data {
|
||||
let secret = str::from_utf8(secret).ok().and_then(|s| s.parse().ok());
|
||||
if secret == Some(*net_traits::PRIVILEGED_SECRET) {
|
||||
if let Ok(bytes) = base64::decode(&bytes[1..]) {
|
||||
if let Ok(bytes) = base64::engine::general_purpose::STANDARD.decode(&bytes[1..])
|
||||
{
|
||||
context.state.extra_certs.add(bytes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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 base64;
|
||||
use base64::Engine;
|
||||
use generic_array::ArrayLength;
|
||||
use net_traits::response::{Response, ResponseBody, ResponseType};
|
||||
use sha2::{Digest, Sha256, Sha384, Sha512};
|
||||
|
@ -123,7 +123,7 @@ fn apply_algorithm_to_response<S: ArrayLength<u8>, D: Digest<OutputSize = S>>(
|
|||
if let ResponseBody::Done(ref vec) = *body {
|
||||
hasher.update(vec);
|
||||
let response_digest = hasher.finalize(); //Now hash
|
||||
base64::encode(&response_digest)
|
||||
base64::engine::general_purpose::STANDARD.encode(&response_digest)
|
||||
} else {
|
||||
unreachable!("Tried to calculate digest of incomplete response body")
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ use crate::hosts::replace_host;
|
|||
use crate::http_loader::HttpState;
|
||||
use async_tungstenite::tokio::{client_async_tls_with_connector_and_config, ConnectStream};
|
||||
use async_tungstenite::WebSocketStream;
|
||||
use base64::Engine;
|
||||
use embedder_traits::resources::{self, Resource};
|
||||
use futures::future::TryFutureExt;
|
||||
use futures::sink::SinkExt;
|
||||
|
@ -93,7 +94,7 @@ fn create_request(
|
|||
}
|
||||
|
||||
if resource_url.password().is_some() || resource_url.username() != "" {
|
||||
let basic = base64::encode(&format!(
|
||||
let basic = base64::engine::general_purpose::STANDARD.encode(&format!(
|
||||
"{}:{}",
|
||||
resource_url.username(),
|
||||
resource_url.password().unwrap_or("")
|
||||
|
|
|
@ -25,7 +25,7 @@ use crate::realms::enter_realm;
|
|||
use crate::script_runtime::JSContext;
|
||||
use crate::task_source::file_reading::FileReadingTask;
|
||||
use crate::task_source::{TaskSource, TaskSourceName};
|
||||
use base64;
|
||||
use base64::Engine;
|
||||
use dom_struct::dom_struct;
|
||||
use encoding_rs::{Encoding, UTF_8};
|
||||
use js::jsapi::Heap;
|
||||
|
@ -89,7 +89,7 @@ pub struct FileReaderSharedFunctionality;
|
|||
|
||||
impl FileReaderSharedFunctionality {
|
||||
pub fn dataurl_format(blob_contents: &[u8], blob_type: String) -> DOMString {
|
||||
let base64 = base64::encode(&blob_contents);
|
||||
let base64 = base64::engine::general_purpose::STANDARD.encode(&blob_contents);
|
||||
|
||||
let dataurl = if blob_type.is_empty() {
|
||||
format!("data:base64,{}", base64)
|
||||
|
|
|
@ -31,7 +31,7 @@ use crate::dom::virtualmethods::VirtualMethods;
|
|||
use crate::dom::webgl2renderingcontext::WebGL2RenderingContext;
|
||||
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
|
||||
use crate::script_runtime::JSContext;
|
||||
use base64;
|
||||
use base64::Engine;
|
||||
use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
|
||||
use canvas_traits::webgl::{GLContextAttributes, WebGLVersion};
|
||||
use dom_struct::dom_struct;
|
||||
|
@ -434,7 +434,7 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
|
|||
let mut url = "data:image/png;base64,".to_owned();
|
||||
// FIXME(nox): Should this use base64::URL_SAFE?
|
||||
// FIXME(nox): https://github.com/marshallpierce/rust-base64/pull/56
|
||||
base64::encode_config_buf(&png, base64::STANDARD, &mut url);
|
||||
base64::engine::general_purpose::STANDARD.encode_string(&png, &mut url);
|
||||
Ok(USVString(url))
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ use crate::webdriver_handlers::jsval_to_webdriver;
|
|||
use crate::window_named_properties;
|
||||
use app_units::Au;
|
||||
use backtrace::Backtrace;
|
||||
use base64;
|
||||
use base64::Engine;
|
||||
use bluetooth_traits::BluetoothRequest;
|
||||
use canvas_traits::webgl::WebGLChan;
|
||||
use crossbeam_channel::{unbounded, Sender, TryRecvError};
|
||||
|
@ -577,7 +577,10 @@ pub fn base64_btoa(input: DOMString) -> Fallible<DOMString> {
|
|||
|
||||
// "and then must apply the base64 algorithm to that sequence of
|
||||
// octets, and return the result. [RFC4648]"
|
||||
Ok(DOMString::from(base64::encode(&octets)))
|
||||
let config =
|
||||
base64::engine::general_purpose::GeneralPurposeConfig::new().with_encode_padding(true);
|
||||
let engine = base64::engine::GeneralPurpose::new(&base64::alphabet::STANDARD, config);
|
||||
Ok(DOMString::from(engine.encode(&octets)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -624,8 +627,12 @@ pub fn base64_atob(input: DOMString) -> Fallible<DOMString> {
|
|||
return Err(Error::InvalidCharacter);
|
||||
}
|
||||
|
||||
let data = base64::decode_config(&input, base64::STANDARD.decode_allow_trailing_bits(true))
|
||||
.map_err(|_| Error::InvalidCharacter)?;
|
||||
let config = base64::engine::general_purpose::GeneralPurposeConfig::new()
|
||||
.with_decode_padding_mode(base64::engine::DecodePaddingMode::RequireNone)
|
||||
.with_decode_allow_trailing_bits(true);
|
||||
let engine = base64::engine::GeneralPurpose::new(&base64::alphabet::STANDARD, config);
|
||||
|
||||
let data = engine.decode(&input).map_err(|_| Error::InvalidCharacter)?;
|
||||
Ok(data.iter().map(|&b| b as char).collect::<String>().into())
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ mod actions;
|
|||
mod capabilities;
|
||||
|
||||
use crate::actions::{InputSourceState, PointerInputState};
|
||||
use base64;
|
||||
use base64::Engine;
|
||||
use capabilities::ServoCapabilities;
|
||||
use compositing::ConstellationMsg;
|
||||
use crossbeam_channel::{after, unbounded, Receiver, Sender};
|
||||
|
@ -1603,7 +1603,7 @@ impl Handler {
|
|||
.write_to(&mut png_data, ImageFormat::Png)
|
||||
.unwrap();
|
||||
|
||||
Ok(base64::encode(png_data.get_ref()))
|
||||
Ok(base64::engine::general_purpose::STANDARD.encode(png_data.get_ref()))
|
||||
}
|
||||
|
||||
fn handle_take_screenshot(&self) -> WebDriverResult<WebDriverResponse> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue