add fn downlaod_page

This commit is contained in:
2020-06-18 08:29:38 +08:00
parent 36a54427db
commit 6d8c4acf34
2 changed files with 18 additions and 1 deletions

View File

@@ -24,7 +24,7 @@ impl Command for CommandDownload {
// println!("{:?}", har);
har.log.entries.iter().for_each(|e| {
println!("{:<100} {}", e.request.url, e.server_ip_address);
println!("{:<100} {:?}", e.request.url, /*e.server_ip_address,*/ e.pageref);
});
Ok(())

View File

@@ -93,4 +93,21 @@ pub struct HarLog {
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Har {
pub log: HarLog,
}
// TODO
pub fn downlaod_page(har: &Har, har_page: &HarPage) {
let page_id = &har_page.id;
har.log.entries.iter().filter(|e| if let Some(pageref) = &e.pageref {
pageref == page_id
} else {
false
}).for_each(|e| {
make_request(&e.request);
});
}
// GET, POST
pub fn make_request(har_request: &HarRequest) -> Option<()> { // ???
None
}