Files
Library/include/Void/Net/Url.hpp
T
faumarayandClaude Opus 4.8 c92dff6ff7 Add Void::Net — HTTP client + URL parser + SOCKS5/CONNECT proxies
New SHARED module built on Boost.Beast/Asio + OpenSSL (all generic, no
application coupling):
- Void::Net::Url — RFC 3986 parse into scheme/host/port/path/query/target
  (Boost.URL), with scheme-default ports and TLS detection.
- Void::Net::HttpClient — synchronous GET/POST/send with TLS (SNI),
  configurable User-Agent and TLS verification, request/response types.
- Proxy support: HTTP CONNECT tunnelling for TLS targets, plain-HTTP
  forwarding, and a full SOCKS5 handshake (auth, IPv4/IPv6/domain).
- Reuses Void::Encoding::Base64 for proxy auth.

Build wiring: Dependencies.cmake resolves Boost (headers + url) and OpenSSL
+ Threads via find_package (system Boost/OpenSSL). Tests cover URL parsing
and live localhost HTTP GET/POST round-trips (full suite 1136 pass).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 16:21:08 +03:00

29 lines
814 B
C++

#pragma once
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
namespace Void::Net
{
/// Parsed components of a URL. `target` is the request-target
/// (path + "?" + query) ready for an HTTP request line; `port` is filled
/// with the scheme default (80/443) when absent.
struct Url {
std::string scheme;
std::string host;
std::string port;
std::string path; ///< encoded path (defaults to "/")
std::string query; ///< encoded query (no leading '?')
std::string target; ///< path + ("?" + query)
bool is_tls = false; ///< scheme is https/wss
/// Parse `url` (RFC 3986) into components. Returns nullopt on a
/// malformed URL. Backed by Boost.URL.
[[nodiscard]] static std::optional<Url> parse(std::string_view url);
};
} // namespace Void::Net