diff options
author | David Kalnischkies <david@kalnischkies.de> | 2018-11-25 16:40:42 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2018-11-25 17:22:43 +0100 |
commit | 37de1902919ac27d4527edc4210f1f927ea376ef (patch) | |
tree | 9df5ae4fb7c7418f84ac3eeb2ab15c49b13acbb8 /methods | |
parent | 85399d2b28ba0bbd3b66e1ab50fde43a9f301f68 (diff) |
Allow setting Referer header for http method
Not needed for common interactions, but for some download-file
interactions it could be useful to set a specific referer as some
servers do not serve requested files otherwise.
Diffstat (limited to 'methods')
-rw-r--r-- | methods/http.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/methods/http.cc b/methods/http.cc index 2e7fca307..d75e9fe84 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -974,6 +974,10 @@ void HttpMethod::SendReq(FetchItem *Itm) Req << "User-Agent: " << ConfigFind("User-Agent", "Debian APT-HTTP/1.3 (" PACKAGE_VERSION ")") << "\r\n"; + auto const referer = ConfigFind("Referer", ""); + if (referer.empty() == false) + Req << "Referer: " << referer << "\r\n"; + Req << "\r\n"; if (Debug == true) |