From ea2d7f4dd5a00097bee8727c3a165c5663ca92a3 Mon Sep 17 00:00:00 2001 From: Sam Gibson Date: Sat, 15 Aug 2015 21:40:41 +1000 Subject: [PATCH] Uses the correct url when reporting http errors --- components/net/http_loader.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index fa0d4b1b617..15fe660b62e 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -231,15 +231,16 @@ impl HttpRequest for WrappedHttpRequest { } fn send(self, body: &Option>) -> Result { + let url = self.request.url.clone(); let mut request_writer = match self.request.start() { Ok(streaming) => streaming, - Err(e) => return Err(LoadError::Connection(Url::parse("http://example.com").unwrap(), e.description().to_string())) + Err(e) => return Err(LoadError::Connection(url, e.description().to_string())) }; if let Some(ref data) = *body { match request_writer.write_all(&data) { Err(e) => { - return Err(LoadError::Connection(Url::parse("http://example.com").unwrap(), e.description().to_string())) + return Err(LoadError::Connection(url, e.description().to_string())) } _ => {} } @@ -247,7 +248,7 @@ impl HttpRequest for WrappedHttpRequest { let response = match request_writer.send() { Ok(w) => w, - Err(e) => return Err(LoadError::Connection(Url::parse("http://example.com").unwrap(), e.description().to_string())) + Err(e) => return Err(LoadError::Connection(url, e.description().to_string())) }; Ok(WrappedHttpResponse { response: response })