curl-fuzzer C++ reference
Loading...
Searching...
No Matches
connect_udp_proxy_mock_server.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) Max Dymond, <cmeister2@gmail.com>, et al.
3 *
4 * SPDX-License-Identifier: curl
5 */
6
9
11
12#include <curl/curl.h>
13
14#include "proto_fuzzer/tls_test_credentials.h"
15
16namespace proto_fuzzer {
17
24
25 // The numeric proxy authority avoids DNS before OPENSOCKETFUNCTION replaces
26 // its transport with MockServer's socketpair. Clearing CONNECT_TO preserves
27 // the scenario's origin in the MASQUE URI template rather than rewriting it
28 // to the baseline loopback sentinel.
29 static constexpr char kProxyUrl[] = "http://127.0.0.1:80";
30 struct curl_blob trust_anchor = {const_cast<char*>(tls_test_credentials::kCertificatePem),
31 sizeof(tls_test_credentials::kCertificatePem) - 1, CURL_BLOB_NOCOPY};
32 (void)curl_easy_setopt(easy, CURLOPT_CONNECT_TO, nullptr);
33 (void)curl_easy_setopt(easy, CURLOPT_PROXY, kProxyUrl);
34 (void)curl_easy_setopt(easy, CURLOPT_PROXYTYPE, static_cast<long>(CURLPROXY_HTTP));
35 (void)curl_easy_setopt(easy, CURLOPT_NOPROXY, "");
36 (void)curl_easy_setopt(easy, CURLOPT_HTTPPROXYTUNNEL, 1L);
37 (void)curl_easy_setopt(easy, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_3ONLY);
38
39 // Capsules carry the origin's QUIC/TLS exchange, so retain the same fixed
40 // trust anchor and hostname verification as the direct HTTP/3 peer.
41 (void)curl_easy_setopt(easy, CURLOPT_CAINFO_BLOB, &trust_anchor);
42 (void)curl_easy_setopt(easy, CURLOPT_SSL_VERIFYPEER, 1L);
43 (void)curl_easy_setopt(easy, CURLOPT_SSL_VERIFYHOST, 2L);
44}
45
46} // namespace proto_fuzzer
void Install(CURL *easy) override
Install the socket transport and force an HTTP/3 origin through a fixed plaintext HTTP/1....
virtual void Install(CURL *easy)
Install the common OPENSOCKETFUNCTION / OPENSOCKETDATA / SOCKOPTFUNCTION callbacks on 'easy'.
Deterministic HTTP/1.1 CONNECT-UDP proxy for HTTP/3 scenarios.