Fix fetching about:blank

When fetching about:blank, response body should be the empty byte
sequence.
Spec: https://fetch.spec.whatwg.org/#concept-basic-fetch

Before this change, response body would be set to `ResponseBody::Empty`,
and then fetching would result in an infinite loop at step 19 in fn
`main_fetch` (methods.rs).
This commit is contained in:
Stjepan Glavina 2016-03-24 11:17:12 +01:00
parent ef8d36d208
commit bcd813d961
2 changed files with 15 additions and 0 deletions

View file

@ -294,6 +294,7 @@ fn basic_fetch(request: Rc<Request>) -> Response {
response.headers.set(ContentType(Mime(
TopLevel::Text, SubLevel::Html,
vec![(Attr::Charset, Value::Utf8)])));
*response.body.lock().unwrap() = ResponseBody::Done(vec![]);
response
},
_ => Response::network_error()