mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 13:27:17 +01:00
removed all Accept-* headers but Accept-Encoding
This commit is contained in:
parent
0ec9defc6e
commit
d47d8d22a3
|
@ -293,11 +293,11 @@ namespace http {
|
|||
}
|
||||
}
|
||||
|
||||
void HTTPReq::RemoveHeader (const std::string& name)
|
||||
void HTTPReq::RemoveHeader (const std::string& name, const std::string& exempt)
|
||||
{
|
||||
for (auto it = headers.begin (); it != headers.end ();)
|
||||
{
|
||||
if (!it->first.compare(0, name.length (), name))
|
||||
if (!it->first.compare(0, name.length (), name) && it->first != exempt)
|
||||
it = headers.erase (it);
|
||||
else
|
||||
it++;
|
||||
|
|
|
@ -16,14 +16,17 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace i2p {
|
||||
namespace http {
|
||||
namespace i2p
|
||||
{
|
||||
namespace http
|
||||
{
|
||||
const char CRLF[] = "\r\n"; /**< HTTP line terminator */
|
||||
const char HTTP_EOH[] = "\r\n\r\n"; /**< HTTP end-of-headers mark */
|
||||
extern const std::vector<std::string> HTTP_METHODS; /**< list of valid HTTP methods */
|
||||
extern const std::vector<std::string> HTTP_VERSIONS; /**< list of valid HTTP versions */
|
||||
|
||||
struct URL {
|
||||
struct URL
|
||||
{
|
||||
std::string schema;
|
||||
std::string user;
|
||||
std::string pass;
|
||||
|
@ -90,7 +93,8 @@ namespace http {
|
|||
|
||||
void AddHeader (const std::string& name, const std::string& value);
|
||||
void UpdateHeader (const std::string& name, const std::string& value);
|
||||
void RemoveHeader (const std::string& name);
|
||||
void RemoveHeader (const std::string& name, const std::string& exempt); // remove all headers starting with name, but exempt
|
||||
void RemoveHeader (const std::string& name) { RemoveHeader (name, ""); };
|
||||
std::string GetHeader (const std::string& name) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -202,11 +202,11 @@ namespace proxy {
|
|||
/* drop common headers */
|
||||
req.RemoveHeader ("Referer");
|
||||
req.RemoveHeader("Via");
|
||||
req.RemoveHeader("Forwarded");
|
||||
req.RemoveHeader("Accept-Language"); // TODO: should exclude all Accept-*, but Accept-Encoding
|
||||
req.RemoveHeader("Forwarded");
|
||||
req.RemoveHeader("Accept-", "Accept-Encoding"); // Accept-*, but Accept-Encoding
|
||||
/* drop proxy-disclosing headers */
|
||||
req.RemoveHeader("X-Forwarded");
|
||||
req.RemoveHeader("Proxy-");
|
||||
req.RemoveHeader("Proxy-"); // Proxy-*
|
||||
/* replace headers */
|
||||
req.UpdateHeader("User-Agent", "MYOB/6.66 (AN/ON)");
|
||||
/* add headers */
|
||||
|
|
Loading…
Reference in a new issue