Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load bare images within an HTML document (#3108) #3131

Merged
merged 1 commit into from Aug 26, 2014
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Load bare images within an HTML document (#3108)

  • Loading branch information
Manishearth committed Aug 26, 2014
commit 22ed3d620d097fad1e4e7e82745f19800ca0b0e9
@@ -526,19 +526,24 @@ pub fn parse_html(page: &Page,
};
parser.set_tree_handler(&mut tree_handler);
debug!("set tree handler");

debug!("loaded page");
loop {
match load_response.progress_port.recv() {
Payload(data) => {
debug!("received data");
parser.parse_chunk(data.as_slice());
}
Done(Err(err)) => {
fail!("Failed to load page URL {:s}, error: {:s}", url.serialize(), err);
}
Done(..) => {
break;
match load_response.metadata.content_type {
Some((ref t, _)) if t.as_slice().eq_ignore_ascii_case("image") => {
let page = format!("<html><body><img src='{:s}' /></body></html>", base_url.serialize());
parser.parse_chunk(page.into_bytes().as_slice());
},
_ => loop {
match load_response.progress_port.recv() {
Payload(data) => {
debug!("received data");
parser.parse_chunk(data.as_slice());
}
Done(Err(err)) => {
fail!("Failed to load page URL {:s}, error: {:s}", url.serialize(), err);
}
Done(..) => {
break;
}
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.