use std::string_view for I2P HTTP headers. constexpr for ecxluded headers list
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / trixie (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions

This commit is contained in:
orignal 2025-07-18 22:39:21 -04:00
parent bfc9540c24
commit 8c204a4c10
2 changed files with 9 additions and 8 deletions

View file

@ -428,7 +428,7 @@ namespace client
else
{
// strip up some headers
static const std::array<std::string_view, 2> excluded // list of excluded headers
static constexpr std::array<std::string_view, 2> excluded // list of excluded headers
{
"Keep-Alive:", "X-I2P"
};
@ -511,7 +511,7 @@ namespace client
if (line == "\r") endOfHeader = true;
else
{
static const std::array<std::string_view, 5> excluded // list of excluded headers
static constexpr std::array<std::string_view, 5> excluded // list of excluded headers
{
"Server:", "Date:", "X-Runtime:", "X-Powered-By:", "Proxy"
};

View file

@ -11,6 +11,7 @@
#include <inttypes.h>
#include <string>
#include <string_view>
#include <set>
#include <tuple>
#include <memory>
@ -30,13 +31,13 @@ namespace client
constexpr size_t I2P_TUNNEL_CONNECTION_BUFFER_SIZE = 8192;
constexpr size_t I2P_TUNNEL_CONNECTION_STREAM_MAX_SEND_BUFFER_SIZE = 8*I2P_TUNNEL_CONNECTION_BUFFER_SIZE;
constexpr size_t I2P_TUNNEL_CONNECTION_STREAM_BUFFER_SIZE = 16384;
const int I2P_TUNNEL_CONNECTION_MAX_IDLE = 3600; // in seconds
const int I2P_TUNNEL_DESTINATION_REQUEST_TIMEOUT = 10; // in seconds
constexpr int I2P_TUNNEL_CONNECTION_MAX_IDLE = 3600; // in seconds
constexpr int I2P_TUNNEL_DESTINATION_REQUEST_TIMEOUT = 10; // in seconds
// for HTTP tunnels
constexpr char X_I2P_DEST_HASH[] = "X-I2P-DestHash"; // hash in base64
constexpr char X_I2P_DEST_B64[] = "X-I2P-DestB64"; // full address in base64
constexpr char X_I2P_DEST_B32[] = "X-I2P-DestB32"; // .b32.i2p address
const int I2P_TUNNEL_HTTP_MAX_HEADER_SIZE = 8192;
constexpr std::string_view X_I2P_DEST_HASH { "X-I2P-DestHash" }; // hash in base64
constexpr std::string_view X_I2P_DEST_B64 { "X-I2P-DestB64" }; // full address in base64
constexpr std::string_view X_I2P_DEST_B32 { "X-I2P-DestB32" }; // .b32.i2p address
constexpr int I2P_TUNNEL_HTTP_MAX_HEADER_SIZE = 8192;
class I2PTunnelConnection: public I2PServiceHandler, public std::enable_shared_from_this<I2PTunnelConnection>
{