mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 11:04:00 +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 ();)
|
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);
|
it = headers.erase (it);
|
||||||
else
|
else
|
||||||
it++;
|
it++;
|
||||||
|
|
|
@ -16,14 +16,17 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace i2p {
|
namespace i2p
|
||||||
namespace http {
|
{
|
||||||
|
namespace http
|
||||||
|
{
|
||||||
const char CRLF[] = "\r\n"; /**< HTTP line terminator */
|
const char CRLF[] = "\r\n"; /**< HTTP line terminator */
|
||||||
const char HTTP_EOH[] = "\r\n\r\n"; /**< HTTP end-of-headers mark */
|
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_METHODS; /**< list of valid HTTP methods */
|
||||||
extern const std::vector<std::string> HTTP_VERSIONS; /**< list of valid HTTP versions */
|
extern const std::vector<std::string> HTTP_VERSIONS; /**< list of valid HTTP versions */
|
||||||
|
|
||||||
struct URL {
|
struct URL
|
||||||
|
{
|
||||||
std::string schema;
|
std::string schema;
|
||||||
std::string user;
|
std::string user;
|
||||||
std::string pass;
|
std::string pass;
|
||||||
|
@ -90,7 +93,8 @@ namespace http {
|
||||||
|
|
||||||
void AddHeader (const std::string& name, const std::string& value);
|
void AddHeader (const std::string& name, const std::string& value);
|
||||||
void UpdateHeader (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;
|
std::string GetHeader (const std::string& name) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -202,11 +202,11 @@ namespace proxy {
|
||||||
/* drop common headers */
|
/* drop common headers */
|
||||||
req.RemoveHeader ("Referer");
|
req.RemoveHeader ("Referer");
|
||||||
req.RemoveHeader("Via");
|
req.RemoveHeader("Via");
|
||||||
req.RemoveHeader("Forwarded");
|
req.RemoveHeader("Forwarded");
|
||||||
req.RemoveHeader("Accept-Language"); // TODO: should exclude all Accept-*, but Accept-Encoding
|
req.RemoveHeader("Accept-", "Accept-Encoding"); // Accept-*, but Accept-Encoding
|
||||||
/* drop proxy-disclosing headers */
|
/* drop proxy-disclosing headers */
|
||||||
req.RemoveHeader("X-Forwarded");
|
req.RemoveHeader("X-Forwarded");
|
||||||
req.RemoveHeader("Proxy-");
|
req.RemoveHeader("Proxy-"); // Proxy-*
|
||||||
/* replace headers */
|
/* replace headers */
|
||||||
req.UpdateHeader("User-Agent", "MYOB/6.66 (AN/ON)");
|
req.UpdateHeader("User-Agent", "MYOB/6.66 (AN/ON)");
|
||||||
/* add headers */
|
/* add headers */
|
||||||
|
|
Loading…
Reference in a new issue