Merge branch 'issue/53' into 'master'

Fix #53 by setting the HTTP user agent string to the latest Firefox ESR.

Closes #53

See merge request alatiera/Hammond!26
This commit is contained in:
Jordan Petridis 2018-03-18 11:34:12 +00:00
commit 260e6015a1

View File

@ -6,7 +6,7 @@ use url::Url;
use hyper::{Client, Method, Request, Response, StatusCode, Uri};
use hyper::client::HttpConnector;
use hyper::header::{ETag, EntityTag, HttpDate, IfModifiedSince, IfNoneMatch, LastModified,
Location};
Location, UserAgent};
use hyper_tls::HttpsConnector;
// use futures::future::ok;
@ -253,6 +253,12 @@ impl Source {
let uri = Uri::from_str(self.uri()).unwrap();
let mut req = Request::new(Method::Get, uri);
// Set the user agent as a fix for issue #53
// TODO: keep this in sync with tor-browser releases
req.headers_mut().set(UserAgent::new(
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",
));
if !ignore_etags {
if let Some(foo) = self.http_etag() {
req.headers_mut().set(IfNoneMatch::Items(vec![