Hi all. I tried not to get body without header, I can't get http://www.perlbot.net, and other sites can, I now want to add header, but did not succeed, please help to see, thank you! How to change it?
The 18 line error info: the trait hyper::header::Header is not implemented for &std::collections::HashMap<&str, &str>
Use the types in the hyper::header module to control headers. For example:
let res = client.get(url)
.header(CacheControl(vec![CacheDirective::MaxAge(0)]))
.header(Connection::keep_alive())
.header(AcceptEncoding(vec![qitem(Encoding::Gzip), qitem(Encoding::Deflate)]))
.send();
mbrubeck: Thanks a lot!. Second questions, the page is charset=gb2312, println! can't print, how to convert to utf8? What modules or functions can be work? thank you!!
I would recommend the encoding crate https://github.com/lifthrasiir/rust-encoding
I doesn't support gb2312, but it supports GBK and GB 18030, which I understand are extensions of gb2312, so it should probably work.