mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Uses the correct url when reporting http errors
This commit is contained in:
parent
d6e1fab278
commit
ea2d7f4dd5
1 changed files with 4 additions and 3 deletions
|
@ -231,15 +231,16 @@ impl HttpRequest for WrappedHttpRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send(self, body: &Option<Vec<u8>>) -> Result<WrappedHttpResponse, LoadError> {
|
fn send(self, body: &Option<Vec<u8>>) -> Result<WrappedHttpResponse, LoadError> {
|
||||||
|
let url = self.request.url.clone();
|
||||||
let mut request_writer = match self.request.start() {
|
let mut request_writer = match self.request.start() {
|
||||||
Ok(streaming) => streaming,
|
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 {
|
if let Some(ref data) = *body {
|
||||||
match request_writer.write_all(&data) {
|
match request_writer.write_all(&data) {
|
||||||
Err(e) => {
|
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() {
|
let response = match request_writer.send() {
|
||||||
Ok(w) => w,
|
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 })
|
Ok(WrappedHttpResponse { response: response })
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue