https.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include <openssl/ossl_typ.h>
  3. #include <util/generic/string.h>
  4. #include <util/generic/strbuf.h>
  5. #include <functional>
  6. namespace NNeh {
  7. class IProtocol;
  8. struct TParsedLocation;
  9. IProtocol* SSLGetProtocol();
  10. IProtocol* SSLPostProtocol();
  11. IProtocol* SSLFullProtocol();
  12. /// if exceed soft limit, reduce quantity unused connections in cache
  13. void SetHttpOutputConnectionsLimits(size_t softLimit, size_t hardLimit);
  14. /// if exceed soft limit, reduce keepalive time for unused connections
  15. void SetHttpInputConnectionsLimits(size_t softLimit, size_t hardLimit);
  16. /// unused input sockets keepalive timeouts
  17. /// real(used) timeout:
  18. /// - max, if not reached soft limit
  19. /// - min, if reached hard limit
  20. /// - approx. linear changed[max..min], while conn. count in range [soft..hard]
  21. void SetHttpInputConnectionsTimeouts(unsigned minSeconds, unsigned maxSeconds);
  22. struct THttpsOptions {
  23. using TVerifyCallback = int (*)(int, X509_STORE_CTX*);
  24. using TPasswordCallback = std::function<TString (const TParsedLocation&, const TString&, const TString&)>;
  25. static TString CAFile;
  26. static TString CAPath;
  27. static TString ClientCertificate;
  28. static TString ClientPrivateKey;
  29. static TString ClientPrivateKeyPassword;
  30. static bool CheckCertificateHostname;
  31. static bool EnableSslServerDebug;
  32. static bool EnableSslClientDebug;
  33. static TVerifyCallback ClientVerifyCallback;
  34. static TPasswordCallback KeyPasswdCallback;
  35. static bool RedirectionNotError;
  36. static bool Set(TStringBuf name, TStringBuf value);
  37. };
  38. }