HTTPSStreamFactory.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // HTTPSStreamFactory.h
  3. //
  4. // $Id: //poco/1.4/NetSSL_OpenSSL/include/Poco/Net/HTTPSStreamFactory.h#1 $
  5. //
  6. // Library: NetSSL_OpenSSL
  7. // Package: HTTPSClient
  8. // Module: HTTPSStreamFactory
  9. //
  10. // Definition of the HTTPSStreamFactory class.
  11. //
  12. // Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH.
  13. // and Contributors.
  14. //
  15. // SPDX-License-Identifier: BSL-1.0
  16. //
  17. #ifndef NetSSL_HTTPSStreamFactory_INCLUDED
  18. #define NetSSL_HTTPSStreamFactory_INCLUDED
  19. #include "Poco/Net/NetSSL.h"
  20. #include "Poco/Net/HTTPSession.h"
  21. #include "Poco/URIStreamFactory.h"
  22. namespace Poco {
  23. namespace Net {
  24. class NetSSL_API HTTPSStreamFactory: public Poco::URIStreamFactory
  25. /// An implementation of the URIStreamFactory interface
  26. /// that handles secure Hyper-Text Transfer Protocol (https) URIs.
  27. {
  28. public:
  29. HTTPSStreamFactory();
  30. /// Creates the HTTPSStreamFactory.
  31. HTTPSStreamFactory(const std::string& proxyHost, Poco::UInt16 proxyPort = HTTPSession::HTTP_PORT);
  32. /// Creates the HTTPSStreamFactory.
  33. ///
  34. /// HTTPS connections will use the given proxy.
  35. HTTPSStreamFactory(const std::string& proxyHost, Poco::UInt16 proxyPort, const std::string& proxyUsername, const std::string& proxyPassword);
  36. /// Creates the HTTPSStreamFactory.
  37. ///
  38. /// HTTPS connections will use the given proxy and
  39. /// will be authorized against the proxy using Basic authentication
  40. /// with the given proxyUsername and proxyPassword.
  41. ~HTTPSStreamFactory();
  42. /// Destroys the HTTPSStreamFactory.
  43. std::istream* open(const Poco::URI& uri);
  44. /// Creates and opens a HTTPS stream for the given URI.
  45. /// The URI must be a https://... URI.
  46. ///
  47. /// Throws a NetException if anything goes wrong.
  48. static void registerFactory();
  49. /// Registers the HTTPSStreamFactory with the
  50. /// default URIStreamOpener instance.
  51. static void unregisterFactory();
  52. /// Unregisters the HTTPSStreamFactory with the
  53. /// default URIStreamOpener instance.
  54. private:
  55. enum
  56. {
  57. MAX_REDIRECTS = 10
  58. };
  59. std::string _proxyHost;
  60. Poco::UInt16 _proxyPort;
  61. std::string _proxyUsername;
  62. std::string _proxyPassword;
  63. };
  64. } } // namespace Poco::Net
  65. #endif // Net_HTTPSStreamFactory_INCLUDED