Upgrade Hyper

This commit is contained in:
Naveen Gattu 2021-12-23 11:15:35 -08:00
parent 5df705a41f
commit a48a111cee
42 changed files with 872 additions and 891 deletions

View file

@ -16,7 +16,8 @@ compositing = { path = "../compositing" }
cookie = "0.11"
crossbeam-channel = "0.4"
euclid = "0.20"
hyper = "0.12"
headers = "0.3"
http = "0.2"
image = "0.23"
ipc-channel = "0.14"
keyboard-types = "0.5"
@ -31,4 +32,4 @@ servo_config = { path = "../config" }
servo_url = { path = "../url" }
style_traits = { path = "../style_traits" }
uuid = { version = "0.8", features = ["v4"] }
webdriver = "0.40"
webdriver = "0.44"

View file

@ -4,7 +4,7 @@
use serde_json::{Map, Value};
use webdriver::capabilities::{BrowserCapabilities, Capabilities};
use webdriver::error::WebDriverResult;
use webdriver::error::{WebDriverError, WebDriverResult};
pub struct ServoCapabilities {
pub browser_name: String,
@ -71,9 +71,16 @@ impl BrowserCapabilities for ServoCapabilities {
Ok(self.accept_custom)
}
fn validate_custom(&self, _: &str, _: &Value) -> WebDriverResult<()> {
fn validate_custom(&mut self, _: &str, _: &Value) -> WebDriverResult<()> {
Ok(())
}
fn web_socket_url(
&mut self,
_: &serde_json::Map<std::string::String, Value>,
) -> Result<bool, WebDriverError> {
todo!()
}
}
fn get_platform_name() -> Option<String> {

View file

@ -22,7 +22,7 @@ use capabilities::ServoCapabilities;
use compositing::ConstellationMsg;
use crossbeam_channel::{after, unbounded, Receiver, Sender};
use euclid::{Rect, Size2D};
use hyper::Method;
use http::method::Method;
use image::{DynamicImage, ImageFormat, RgbImage};
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
@ -70,7 +70,7 @@ use webdriver::httpapi::WebDriverExtensionRoute;
use webdriver::response::{CookieResponse, CookiesResponse};
use webdriver::response::{ElementRectResponse, NewSessionResponse, ValueResponse};
use webdriver::response::{TimeoutsResponse, WebDriverResponse, WindowRectResponse};
use webdriver::server::{self, Session, WebDriverHandler};
use webdriver::server::{self, Session, SessionTeardownKind, WebDriverHandler};
fn extension_routes() -> Vec<(Method, &'static str, ServoExtensionRoute)> {
return vec![
@ -103,6 +103,7 @@ fn cookie_msg_to_cookie(cookie: cookie::Cookie) -> Cookie {
.map(|time| Date(time.to_timespec().sec as u64)),
secure: cookie.secure().unwrap_or(false),
http_only: cookie.http_only().unwrap_or(false),
same_site: cookie.same_site().map(|s| s.to_string()),
}
}
@ -112,7 +113,12 @@ pub fn start_server(port: u16, constellation_chan: Sender<ConstellationMsg>) {
.name("WebDriverHttpServer".to_owned())
.spawn(move || {
let address = SocketAddrV4::new("0.0.0.0".parse().unwrap(), port);
match server::start(SocketAddr::V4(address), handler, extension_routes()) {
match server::start(
"localhost".to_owned(),
SocketAddr::V4(address),
handler,
extension_routes(),
) {
Ok(listening) => info!("WebDriver server listening on {}", listening.socket),
Err(_) => panic!("Unable to start WebDriver HTTPD server"),
}
@ -1780,7 +1786,7 @@ impl WebDriverHandler<ServoExtensionRoute> for Handler {
}
}
fn delete_session(&mut self, _session: &Option<Session>) {
fn teardown_session(&mut self, _session: SessionTeardownKind) {
self.session = None;
}
}