Commit bd02a7e4 authored by jan.koester's avatar jan.koester
Browse files

test

parent 079ca564
Loading
Loading
Loading
Loading
+1 −0
Changes for CMakeLists.txt: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ set(PROXYPLUS_CORE_SOURCES
    src/store/ConfigStore.cpp
    src/cluster/ClusterManager.cpp
    src/plugin/PluginManager.cpp
    src/http/HttpProxyPath.cpp
    src/http/HttpProxyServer.cpp
    src/smtp/SmtpProxyServer.cpp
    src/api/JsonApiServer.cpp
+18 −0
Changes for src/http/HttpProxyPath.cpp: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
#include "HttpProxyPath.h"

namespace proxyplus::httpproxy::detail {

std::string buildForwardTarget(const std::string &routePath,
                               const std::string &originalTarget,
                               const std::string &pathPrefix) {
    std::string target = routePath.substr(pathPrefix.size());
    if (target.empty() || target[0] != '/') target = "/" + target;

    // HttpRequest::getRequestURL() intentionally strips the query string for route matching.
    // Recover it from getRequest(), which retains the complete request target for H1/H2/H3.
    const size_t query = originalTarget.find('?');
    if (query != std::string::npos) target.append(originalTarget.substr(query));
    return target;
}

} // namespace proxyplus::httpproxy::detail
+14 −0
Changes for src/http/HttpProxyPath.h: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
#pragma once

#include <string>

namespace proxyplus::httpproxy::detail {

// Builds the origin-form request target sent upstream. routePath is deliberately the
// query-free value used for route matching, while originalTarget supplies the query string
// that must survive proxying (notably Git smart HTTP's ?service=git-upload-pack discovery).
std::string buildForwardTarget(const std::string &routePath,
                               const std::string &originalTarget,
                               const std::string &pathPrefix);

} // namespace proxyplus::httpproxy::detail
+2 −13
Changes for src/http/HttpProxyServer.cpp: 2 added lines, 13 removed lines.
Original line number Diff line number Diff line
#include "HttpProxyServer.h"

#include "HttpProxyPath.h"

#include <algorithm>
#include <cctype>
#include <iostream>
@@ -103,19 +105,6 @@ netplus::TlsTrustPolicy trustPolicyFor(const store::HttpRouteRecord &route) {

} // namespace

std::string detail::buildForwardTarget(const std::string &routePath,
                                       const std::string &originalTarget,
                                       const std::string &pathPrefix) {
    std::string target = routePath.substr(pathPrefix.size());
    if (target.empty() || target[0] != '/') target = "/" + target;

    // HttpRequest::getRequestURL() intentionally strips the query string for route matching.
    // Recover it from getRequest(), which retains the complete request target for H1/H2/H3.
    const size_t query = originalTarget.find('?');
    if (query != std::string::npos) target.append(originalTarget.substr(query));
    return target;
}

HttpProxyController::HttpProxyController(std::vector<netplus::socket *> serverSockets,
                                          std::string listenerLabel,
                                          bool tlsActive,
+0 −11
Changes for src/http/HttpProxyServer.h: 0 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -17,17 +17,6 @@

namespace proxyplus::httpproxy {

namespace detail {

// Builds the origin-form request target sent upstream. routePath is deliberately the
// query-free value used for route matching, while originalTarget supplies the query string
// that must survive proxying (notably Git smart HTTP's ?service=git-upload-pack discovery).
std::string buildForwardTarget(const std::string &routePath,
                               const std::string &originalTarget,
                               const std::string &pathPrefix);

} // namespace detail

// The per-connection request handler. There is no reverse-proxy class in libhttppp (see
// docs/ARCHITECTURE.md §4) -- this combines HttpEvent::RequestEvent (inbound) with
// HttpClient (outbound) itself.
Loading