aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2016-04-17 16:43:55 -0400
committerCorey Farwell <coreyf@rwell.org>2016-04-17 16:43:55 -0400
commit8e14cbccc3d5ad7191fe616cda3b82a799eedad0 (patch)
treef6070c01f95240428fb5c9bb5e446cf341dc1a45
parent07209c75db8c24d878e633ce909d05156f2b70b9 (diff)
downloadservo-8e14cbccc3d5ad7191fe616cda3b82a799eedad0.tar.gz
servo-8e14cbccc3d5ad7191fe616cda3b82a799eedad0.zip
Add pref for HTTP redirection limit.
The pref key name matches the associated Gecko pref key name.
-rw-r--r--components/net/http_loader.rs6
-rw-r--r--resources/prefs.json1
2 files changed, 3 insertions, 4 deletions
diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs
index 94e455df9d6..dc31dc3b2c7 100644
--- a/components/net/http_loader.rs
+++ b/components/net/http_loader.rs
@@ -44,6 +44,7 @@ use time::Tm;
#[cfg(any(target_os = "macos", target_os = "linux"))]
use tinyfiledialogs;
use url::Url;
+use util::prefs;
use util::resource_files::resources_dir_path;
use util::thread::spawn_named;
use uuid;
@@ -726,10 +727,7 @@ pub fn load<A, B>(load_data: LoadData,
user_agent: String,
cancel_listener: &CancellationListener)
-> Result<StreamedResponse<A::R>, LoadError> where A: HttpRequest + 'static, B: UIProvider {
- // FIXME: At the time of writing this FIXME, servo didn't have any central
- // location for configuration. If you're reading this and such a
- // repository DOES exist, please update this constant to use it.
- let max_redirects = 50;
+ let max_redirects = prefs::get_pref("network.http.redirection-limit").as_i64().unwrap() as u32;
let mut iters = 0;
// URL of the document being loaded, as seen by all the higher-level code.
let mut doc_url = load_data.url.clone();
diff --git a/resources/prefs.json b/resources/prefs.json
index 6b6cbda1f71..1ce318c581b 100644
--- a/resources/prefs.json
+++ b/resources/prefs.json
@@ -49,6 +49,7 @@
"layout.text-orientation.enabled": false,
"layout.viewport.enabled": false,
"layout.writing-mode.enabled": false,
+ "network.http.redirection-limit": 50,
"network.mime.sniff": false,
"shell.native-titlebar.enabled": true,
"shell.homepage": "http://servo.org"