diff options
author | Corey Farwell <coreyf@rwell.org> | 2016-04-17 16:53:59 -0400 |
---|---|---|
committer | Corey Farwell <coreyf@rwell.org> | 2016-04-17 20:14:08 -0400 |
commit | da0adeb0ac65fcbd205329cc221668449b3766a8 (patch) | |
tree | 436162269f9a8dc4112af9993bfe1129159bd64f /components/net/http_loader.rs | |
parent | 8e14cbccc3d5ad7191fe616cda3b82a799eedad0 (diff) | |
download | servo-da0adeb0ac65fcbd205329cc221668449b3766a8.tar.gz servo-da0adeb0ac65fcbd205329cc221668449b3766a8.zip |
Verify number of redirects when we reach limit.
Diffstat (limited to 'components/net/http_loader.rs')
-rw-r--r-- | components/net/http_loader.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index dc31dc3b2c7..5aca88e19eb 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -166,7 +166,7 @@ fn load_for_consumer(load_data: LoadData, Err(LoadError::Connection(url, e)) => { send_error(url, e, start_chan) } - Err(LoadError::MaxRedirects(url)) => { + Err(LoadError::MaxRedirects(url, _)) => { send_error(url, "too many redirects".to_owned(), start_chan) } Err(LoadError::Cors(url, msg)) | @@ -336,7 +336,7 @@ pub enum LoadError { Ssl(Url, String), InvalidRedirect(Url, String), Decoding(Url, String), - MaxRedirects(Url), + MaxRedirects(Url, u32), // u32 indicates number of redirects that occurred ConnectionAborted(String), Cancelled(Url, String), } @@ -759,7 +759,7 @@ pub fn load<A, B>(load_data: LoadData, } if iters > max_redirects { - return Err(LoadError::MaxRedirects(doc_url)); + return Err(LoadError::MaxRedirects(doc_url, iters - 1)); } if &*doc_url.scheme != "http" && &*doc_url.scheme != "https" { |