Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
610ef40
Refactors http_loader::load to be synchronous w/ an async wrapper
samfoo Aug 1, 2015
c8c36f4
Injects the network connector as a dependency into http_loader::load
samfoo Aug 2, 2015
9ac250c
Abstracts out initial client connection and SSL errors (which I don't…
samfoo Aug 2, 2015
67aa113
Adds simple POC unit test for load
samfoo Aug 2, 2015
6cba33a
Abstracts the hyper connection to a servo HttpRequester trait
samfoo Aug 7, 2015
7633cd5
Abstract everything but the response from hyper
samfoo Aug 9, 2015
81fe593
Removes HttpRequest, adds HttpResponse wrapper
samfoo Aug 9, 2015
06f09f6
Adds tests for redirecting
samfoo Aug 10, 2015
7a09c2d
Shifts to a series of traits/associated types instead of having a req…
samfoo Aug 15, 2015
26a6e05
Adds more tests for checking request headers
samfoo Aug 15, 2015
ffc3877
Adds tests for setting/getting cookies from load
samfoo Aug 15, 2015
c093ce8
Only use the resource manager's HSTS list.
samfoo Aug 15, 2015
5a60fdf
Moves STS update code to a function
samfoo Aug 15, 2015
d6e1fab
Uses hyper's ContentEncoding instead of get_raw
samfoo Aug 15, 2015
ea2d7f4
Uses the correct url when reporting http errors
samfoo Aug 15, 2015
15d8209
Fixes tidy overlong lines
samfoo Aug 15, 2015
3c756d2
Avoids sending a request body on a redirect
samfoo Aug 15, 2015
879b058
Returns LoadResponse struct instead of a tuple
samfoo Aug 16, 2015
6064ee8
Eliminates need to box response reader
samfoo Aug 16, 2015
2eaac7e
Adds tests for gzip/deflate response decoding
samfoo Aug 16, 2015
04b7ce0
Tests rewriting redirects of POST as GET
samfoo Aug 16, 2015
9322954
Moves devtools messaging to functions
samfoo Aug 16, 2015
9793826
Removes nossl
samfoo Aug 16, 2015
d53af0d
Fixes merge errors
samfoo Aug 22, 2015
94284fc
Fixes new tidy problems
samfoo Aug 22, 2015
6de6130
Removes inline'ing
samfoo Aug 26, 2015
84ae53e
Indents arguments to be more readable
samfoo Aug 27, 2015
1811ffa
Uses `and_then` instead of more complicated matching
samfoo Aug 27, 2015
d8acb89
Inverts conditional and returns
samfoo Aug 27, 2015
918f8a7
Removes unnecessary clone
samfoo Aug 27, 2015
04c012d
Binds name instead of inlining value for readability
samfoo Aug 27, 2015
3b8bada
Fixes code review nits
samfoo Aug 27, 2015
a1fd235
Moves devtools request msg logic to where the request is sent
samfoo Aug 27, 2015
667b563
Renames LoadResponse
samfoo Aug 27, 2015
ac0e4b4
Renames RequestType
samfoo Aug 27, 2015
86df1d3
Renames AssertMustHaveHeadersRequest
samfoo Aug 27, 2015
287dc73
Extracts some dense code to a let binding
samfoo Aug 27, 2015
9b1f223
Adds a test for non-default accept headers
samfoo Aug 27, 2015
976dbc5
Adds a test for non-default accept-encoding headers
samfoo Aug 27, 2015
f257b5f
Adds content-length to empty-bodied non-GET/HEAD requests
samfoo Aug 30, 2015
4b6f07c
Resolves strange borrow/type checking issues from new thread naming
samfoo Aug 30, 2015
9d0f418
Resolves merge conflict without wonky cloning
samfoo Aug 30, 2015
43e0c4a
Prevents unwrapping invalid location url domains
samfoo Aug 31, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
715 changes: 452 additions & 263 deletions components/net/http_loader.rs

Large diffs are not rendered by default.

48 changes: 25 additions & 23 deletions components/net/resource_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use std::borrow::ToOwned;
use std::boxed::FnBox;
use std::sync::Arc;
use std::sync::Mutex;
use std::sync::mpsc::{channel, Sender};

pub enum ProgressSender {
Expand Down Expand Up @@ -161,23 +160,26 @@ impl ResourceChannelManager {
fn start(&mut self) {
loop {
match self.from_client.recv().unwrap() {
ControlMsg::Load(load_data, consumer) => {
self.resource_manager.load(load_data, consumer)
}
ControlMsg::SetCookiesForUrl(request, cookie_list, source) => {
self.resource_manager.set_cookies_for_url(request, cookie_list, source)
}
ControlMsg::GetCookiesForUrl(url, consumer, source) => {
consumer.send(self.resource_manager.cookie_storage.cookies_for_url(&url, source)).unwrap();
}
ControlMsg::SetHSTSEntryForHost(host, include_subdomains, max_age) => {
if let Some(entry) = HSTSEntry::new(host, include_subdomains, Some(max_age)) {
self.resource_manager.add_hsts_entry(entry)
}
}
ControlMsg::Exit => {
break
}
ControlMsg::Load(load_data, consumer) => {
self.resource_manager.load(load_data, consumer)
}
ControlMsg::SetCookiesForUrl(request, cookie_list, source) => {
self.resource_manager.set_cookies_for_url(request, cookie_list, source)
}
ControlMsg::GetCookiesForUrl(url, consumer, source) => {
consumer.send(self.resource_manager.cookie_storage.cookies_for_url(&url, source)).unwrap();
}
ControlMsg::SetHSTSEntryForHost(host, include_subdomains, max_age) => {
if let Some(entry) = HSTSEntry::new(host, include_subdomains, Some(max_age)) {
self.resource_manager.add_hsts_entry(entry)
}
}
ControlMsg::GetHostMustBeSecured(host, consumer) => {
consumer.send(self.resource_manager.is_host_sts(&*host)).unwrap();
}
ControlMsg::Exit => {
break
}
}
}
}
Expand All @@ -189,7 +191,7 @@ pub struct ResourceManager {
resource_task: IpcSender<ControlMsg>,
mime_classifier: Arc<MIMEClassifier>,
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
hsts_list: Arc<Mutex<HSTSList>>
hsts_list: HSTSList
}

impl ResourceManager {
Expand All @@ -203,7 +205,7 @@ impl ResourceManager {
resource_task: resource_task,
mime_classifier: Arc::new(MIMEClassifier::new()),
devtools_chan: devtools_channel,
hsts_list: Arc::new(Mutex::new(hsts_list))
hsts_list: hsts_list
}
}
}
Expand All @@ -221,11 +223,11 @@ impl ResourceManager {
}

pub fn add_hsts_entry(&mut self, entry: HSTSEntry) {
self.hsts_list.lock().unwrap().push(entry);
self.hsts_list.push(entry);
}

pub fn is_host_sts(&self, host: &str) -> bool {
self.hsts_list.lock().unwrap().is_host_secure(host)
self.hsts_list.is_host_secure(host)
}

fn load(&mut self, mut load_data: LoadData, consumer: LoadConsumer) {
Expand All @@ -241,7 +243,7 @@ impl ResourceManager {
let loader = match &*load_data.url.scheme {
"file" => from_factory(file_loader::factory),
"http" | "https" | "view-source" =>
http_loader::factory(self.resource_task.clone(), self.devtools_chan.clone(), self.hsts_list.clone()),
http_loader::factory(self.resource_task.clone(), self.devtools_chan.clone()),
"data" => from_factory(data_loader::factory),
"about" => from_factory(about_loader::factory),
_ => {
Expand Down
1 change: 1 addition & 0 deletions components/net_traits/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ pub enum ControlMsg {
GetCookiesForUrl(Url, IpcSender<Option<String>>, CookieSource),
/// Store a domain's STS information
SetHSTSEntryForHost(String, IncludeSubdomains, u64),
GetHostMustBeSecured(String, IpcSender<bool>),
Exit
}

Expand Down
1 change: 1 addition & 0 deletions components/servo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions components/util/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ pub struct Opts {

pub nonincremental_layout: bool,

pub nossl: bool,

/// Where to load userscripts from, if any. An empty string will load from
/// the resources/user-agent-js directory, and if the option isn't passed userscripts
/// won't be loaded
Expand Down Expand Up @@ -383,7 +381,6 @@ pub fn default_opts() -> Opts {
mem_profiler_period: None,
layout_threads: 1,
nonincremental_layout: false,
nossl: false,
userscripts: None,
user_stylesheets: Vec::new(),
output_file: None,
Expand Down Expand Up @@ -532,7 +529,6 @@ pub fn from_cmdline_args(args: &[String]) {
};

let nonincremental_layout = opt_match.opt_present("i");
let nossl = opt_match.opt_present("no-ssl");

let mut bubble_inline_sizes_separately = debug_options.bubble_widths;
if debug_options.trace_layout {
Expand Down Expand Up @@ -588,7 +584,6 @@ pub fn from_cmdline_args(args: &[String]) {
mem_profiler_period: mem_profiler_period,
layout_threads: layout_threads,
nonincremental_layout: nonincremental_layout,
nossl: nossl,
userscripts: opt_match.opt_default("userscripts", ""),
user_stylesheets: user_stylesheets,
output_file: opt_match.opt_str("o"),
Expand Down
1 change: 1 addition & 0 deletions tests/unit/net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ cookie = "0.1"
hyper = "0.6"
url = "0.2"
time = "0.1"
flate2 = "0.2.0"
Loading