-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathsni_utility.h
34 lines (28 loc) · 1.33 KB
/
sni_utility.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include <string>
#include <vector>
#include "nighthawk/common/uri.h"
#include "external/envoy//envoy/http/protocol.h"
namespace Nighthawk {
namespace Client {
class SniUtility : public Envoy::Logger::Loggable<Envoy::Logger::Id::main> {
public:
/**
* Computes the SNI host based on the passed in uri(s), request headers, and protocol.
* Given a vector of Uris containing a single entry, its host fragment will be considered.
* Subsequently the passed request headers will be scanned for any host headers to override any
* Uri-derived sni host. If the passed in protocol is HTTP/2 or higher, next to host, :authority
* will be considered as well.
*
* @param parsed_uris The parsed target uris configured for the load test.
* @param request_headers Request headers to scan.
* @param protocol The anticipated protocol that will be used.
* @return std::string The sni-host derived from the configured load test target Uris and any
* host/authority request-headers found. Empty if no (unambiguous) sni host could be derived.
*/
static std::string computeSniHost(const std::vector<UriPtr>& parsed_uris,
const std::vector<std::string>& request_headers,
const Envoy::Http::Protocol protocol);
};
} // namespace Client
} // namespace Nighthawk