mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Fix logic in http_loader
We don't need to repeatedly read the headers, and need to send the Done message.
This commit is contained in:
parent
c94d601ebf
commit
e10d3889b7
1 changed files with 6 additions and 4 deletions
|
@ -37,12 +37,13 @@ fn load(url: Url, progress_chan: Chan<ProgressMsg>) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
loop {
|
for header in response.headers.iter() {
|
||||||
for header in response.headers.iter() {
|
info!(" - %s: %s", header.header_name(), header.header_value());
|
||||||
info!(" - %s: %s", header.header_name(), header.header_value());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
loop {
|
||||||
let mut buf = vec::with_capacity(1024);
|
let mut buf = vec::with_capacity(1024);
|
||||||
|
|
||||||
unsafe { vec::raw::set_len(&mut buf, 1024) };
|
unsafe { vec::raw::set_len(&mut buf, 1024) };
|
||||||
match response.read(buf) {
|
match response.read(buf) {
|
||||||
Some(len) => {
|
Some(len) => {
|
||||||
|
@ -55,6 +56,7 @@ fn load(url: Url, progress_chan: Chan<ProgressMsg>) {
|
||||||
}
|
}
|
||||||
progress_chan.send(Payload(buf));
|
progress_chan.send(Payload(buf));
|
||||||
}
|
}
|
||||||
|
progress_chan.send(Done(Ok(())));
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Quick hack to convert ip addresses to SocketAddr
|
// FIXME: Quick hack to convert ip addresses to SocketAddr
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue