blob: 5f10c42b8a01d392bf76c864bc74fd57327e1c05 (
plain) (
blame)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#include "options.h"
#include <util/stream/output.h>
#include <util/string/cast.h>
#include <util/digest/numeric.h>
#include <util/network/ip.h>
#include <util/network/socket.h>
#include <util/generic/hash_set.h>
#include <util/generic/yexception.h>
using TAddr = THttpServerOptions::TAddr;
static inline TString AddrToString(const TAddr& addr) {
return addr.Addr + ":" + ToString(addr.Port);
}
static inline TNetworkAddress ToNetworkAddr(const TString& address, ui16 port) {
if (address.empty() || address == TStringBuf("*")) {
return TNetworkAddress(port);
}
return TNetworkAddress(address, port);
}
void THttpServerOptions::BindAddresses(TBindAddresses& ret) const {
THashSet<TString> check;
for (auto addr : BindSockaddr) {
if (!addr.Port) {
addr.Port = Port;
}
const TString straddr = AddrToString(addr);
if (check.find(straddr) == check.end()) {
check.insert(straddr);
ret.push_back(ToNetworkAddr(addr.Addr, addr.Port));
}
}
if (ret.empty()) {
ret.push_back(Host ? TNetworkAddress(Host, Port) : TNetworkAddress(Port));
}
}
void THttpServerOptions::DebugPrint(IOutputStream& stream) const noexcept {
stream << "Port: " << Port << "\n";
stream << "Host: " << Host << "\n";
stream << "KeepAliveEnabled: " << KeepAliveEnabled << "\n";
stream << "CompressionEnabled: " << CompressionEnabled << "\n";
stream << "nThreads: " << nThreads << "\n";
stream << "nListenerThreads: " << nListenerThreads << "\n";
stream << "MaxQueueSize: " << MaxQueueSize << "\n";
stream << "nFThreads: " << nFThreads << "\n";
stream << "MaxFQueueSize: " << MaxFQueueSize << "\n";
stream << "MaxConnections: " << MaxConnections << "\n";
stream << "MaxRequestsPerConnection: " << MaxRequestsPerConnection << "\n";
stream << "ClientTimeout(ms): " << ClientTimeout.MilliSeconds() << "\n";
}
|