aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/neh/https.h
blob: 6dbb5370d773433d7210dabf014fb4bceed3a4ab (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
#pragma once

#include <contrib/libs/openssl/include/openssl/ossl_typ.h>

#include <util/generic/string.h>
#include <util/generic/strbuf.h>

#include <functional>

namespace NNeh {
    class IProtocol;
    struct TParsedLocation;

    IProtocol* SSLGetProtocol();
    IProtocol* SSLPostProtocol();
    IProtocol* SSLFullProtocol();

    /// if exceed soft limit, reduce quantity unused connections in cache
    void SetHttpOutputConnectionsLimits(size_t softLimit, size_t hardLimit);

    /// if exceed soft limit, reduce keepalive time for unused connections
    void SetHttpInputConnectionsLimits(size_t softLimit, size_t hardLimit);

    /// unused input sockets keepalive timeouts
    /// real(used) timeout:
    ///   - max, if not reached soft limit
    ///   - min, if reached hard limit
    ///   - approx. linear changed[max..min], while conn. count in range [soft..hard]
    void SetHttpInputConnectionsTimeouts(unsigned minSeconds, unsigned maxSeconds);

    struct THttpsOptions {
        using TVerifyCallback = int (*)(int, X509_STORE_CTX*);
        using TPasswordCallback = std::function<TString (const TParsedLocation&, const TString&, const TString&)>;
        static TString CAFile;
        static TString CAPath;
        static TString ClientCertificate;
        static TString ClientPrivateKey;
        static TString ClientPrivateKeyPassword;
        static bool CheckCertificateHostname;
        static bool EnableSslServerDebug;
        static bool EnableSslClientDebug;
        static TVerifyCallback ClientVerifyCallback;
        static TPasswordCallback KeyPasswdCallback;
        static bool RedirectionNotError;
        static bool Set(TStringBuf name, TStringBuf value);
    };
}