mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-22 00:59:08 +01:00
fix #823, reindent code
This commit is contained in:
parent
5c3992018f
commit
a91641e427
3 changed files with 555 additions and 534 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2017, The PurpleI2P Project
|
* Copyright (c) 2013-2019, The PurpleI2P Project
|
||||||
*
|
*
|
||||||
* This file is part of Purple i2pd project and licensed under BSD3
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
*
|
*
|
||||||
|
@ -63,7 +63,8 @@ namespace http {
|
||||||
{
|
{
|
||||||
while ((pos + len) < max && isspace(line.at(pos + len)))
|
while ((pos + len) < max && isspace(line.at(pos + len)))
|
||||||
len++;
|
len++;
|
||||||
if (len == 1) return std::make_pair("", ""); // no following space, but something else
|
if (len == 1)
|
||||||
|
return std::make_pair("", ""); // no following space, but something else
|
||||||
}
|
}
|
||||||
return std::make_pair(line.substr(0, pos), line.substr(pos + len));
|
return std::make_pair(line.substr(0, pos), line.substr(pos + len));
|
||||||
}
|
}
|
||||||
|
@ -409,7 +410,6 @@ namespace http {
|
||||||
if (pos >= eoh)
|
if (pos >= eoh)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return eoh + strlen(HTTP_EOH);
|
return eoh + strlen(HTTP_EOH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2016, The PurpleI2P Project
|
* Copyright (c) 2013-2019, The PurpleI2P Project
|
||||||
*
|
*
|
||||||
* This file is part of Purple i2pd project and licensed under BSD3
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2019, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -5,6 +13,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "I2PService.h"
|
#include "I2PService.h"
|
||||||
|
@ -211,7 +220,6 @@ namespace proxy {
|
||||||
void HTTPReqHandler::SanitizeHTTPRequest(i2p::http::HTTPReq & req)
|
void HTTPReqHandler::SanitizeHTTPRequest(i2p::http::HTTPReq & req)
|
||||||
{
|
{
|
||||||
/* drop common headers */
|
/* drop common headers */
|
||||||
req.RemoveHeader("Referrer");
|
|
||||||
req.RemoveHeader("Via");
|
req.RemoveHeader("Via");
|
||||||
req.RemoveHeader("From");
|
req.RemoveHeader("From");
|
||||||
req.RemoveHeader("Forwarded");
|
req.RemoveHeader("Forwarded");
|
||||||
|
@ -221,6 +229,19 @@ namespace proxy {
|
||||||
req.RemoveHeader("Proxy-"); // 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)");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* according to i2p ticket #1862:
|
||||||
|
* leave Referrer if requested URL with same schema, host and port,
|
||||||
|
* otherwise, drop it.
|
||||||
|
*/
|
||||||
|
if(req.GetHeader("Referrer") != "") {
|
||||||
|
i2p::http::URL reqURL; reqURL.parse(req.uri);
|
||||||
|
i2p::http::URL refURL; refURL.parse(req.GetHeader("Referrer"));
|
||||||
|
if(!boost::iequals(reqURL.schema, refURL.schema) || !boost::iequals(reqURL.host, refURL.host) || reqURL.port != refURL.port)
|
||||||
|
req.RemoveHeader("Referrer");
|
||||||
|
}
|
||||||
|
|
||||||
/* add headers */
|
/* add headers */
|
||||||
/* close connection, if not Connection: (U|u)pgrade (for websocket) */
|
/* close connection, if not Connection: (U|u)pgrade (for websocket) */
|
||||||
auto h = req.GetHeader ("Connection");
|
auto h = req.GetHeader ("Connection");
|
||||||
|
|
Loading…
Add table
Reference in a new issue