aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/NetSSL_OpenSSL/include/Poco/Net/HTTPSStreamFactory.h
blob: 2fd3515c88f6de0615106e1b65d6f6125cf320b7 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// HTTPSStreamFactory.h
//
// Library: NetSSL_OpenSSL
// Package: HTTPSClient
// Module:  HTTPSStreamFactory
//
// Definition of the HTTPSStreamFactory class.
//
// Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier:	BSL-1.0
//


#ifndef NetSSL_HTTPSStreamFactory_INCLUDED
#define NetSSL_HTTPSStreamFactory_INCLUDED


#include "Poco/Net/NetSSL.h"
#include "Poco/Net/HTTPSession.h"
#include "Poco/URIStreamFactory.h"


namespace Poco {
namespace Net {


class NetSSL_API HTTPSStreamFactory: public Poco::URIStreamFactory
	/// An implementation of the URIStreamFactory interface
	/// that handles secure Hyper-Text Transfer Protocol (https) URIs.
{
public:
	HTTPSStreamFactory();
		/// Creates the HTTPSStreamFactory.

	HTTPSStreamFactory(const std::string& proxyHost, Poco::UInt16 proxyPort = HTTPSession::HTTP_PORT);
		/// Creates the HTTPSStreamFactory.
		///
		/// HTTPS connections will use the given proxy.

	HTTPSStreamFactory(const std::string& proxyHost, Poco::UInt16 proxyPort, const std::string& proxyUsername, const std::string& proxyPassword);
		/// Creates the HTTPSStreamFactory.
		///
		/// HTTPS connections will use the given proxy and
		/// will be authorized against the proxy using Basic authentication
		/// with the given proxyUsername and proxyPassword.

	~HTTPSStreamFactory();
		/// Destroys the HTTPSStreamFactory.
		
	std::istream* open(const Poco::URI& uri);
		/// Creates and opens a HTTPS stream for the given URI.
		/// The URI must be a https://... URI.
		///
		/// Throws a NetException if anything goes wrong.
		
	static void registerFactory();
		/// Registers the HTTPSStreamFactory with the
		/// default URIStreamOpener instance.	

	static void unregisterFactory();
		/// Unregisters the HTTPSStreamFactory with the
		/// default URIStreamOpener instance.	
		
private:
	enum
	{
		MAX_REDIRECTS = 10
	};
	
	std::string  _proxyHost;
	Poco::UInt16 _proxyPort;
	std::string  _proxyUsername;
	std::string  _proxyPassword;
};


} } // namespace Poco::Net


#endif // Net_HTTPSStreamFactory_INCLUDED