Panda3D
httpClient.I
1 // Filename: httpClient.I
2 // Created by: drose (24Sep02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: HTTPClient::set_try_all_direct
18 // Access: Published
19 // Description: If this is set true, then after a connection attempt
20 // through a proxy fails, we always try a direct
21 // connection, regardless of whether the host is listed
22 // on the direct_host_spec list. If this is false, a
23 // direct attempt is not made when we have a proxy in
24 // effect, even if the proxy fails.
25 ////////////////////////////////////////////////////////////////////
26 INLINE void HTTPClient::
27 set_try_all_direct(bool try_all_direct) {
28  _try_all_direct = try_all_direct;
29 }
30 
31 ////////////////////////////////////////////////////////////////////
32 // Function: HTTPClient::get_try_all_direct
33 // Access: Published
34 // Description: Returns whether a failed connection through a proxy
35 // will be followed up by a direct connection attempt,
36 // false otherwise.
37 ////////////////////////////////////////////////////////////////////
38 INLINE bool HTTPClient::
39 get_try_all_direct() const {
40  return _try_all_direct;
41 }
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: HTTPClient::set_client_certificate_filename
45 // Access: Published
46 // Description: Sets the filename of the pem-formatted file that will
47 // be read for the client public and private keys if an
48 // SSL server requests a certificate. Either this or
49 // set_client_certificate_pem() may be used to specify a
50 // client certificate.
51 ////////////////////////////////////////////////////////////////////
52 INLINE void HTTPClient::
53 set_client_certificate_filename(const Filename &filename) {
54  _client_certificate_filename = filename;
55  _client_certificate_pem = string();
56  unload_client_certificate();
57 }
58 
59 ////////////////////////////////////////////////////////////////////
60 // Function: HTTPClient::set_client_certificate_pem
61 // Access: Published
62 // Description: Sets the pem-formatted contents of the certificate
63 // that will be parsed for the client public and private
64 // keys if an SSL server requests a certificate. Either
65 // this or set_client_certificate_filename() may be used
66 // to specify a client certificate.
67 ////////////////////////////////////////////////////////////////////
68 INLINE void HTTPClient::
69 set_client_certificate_pem(const string &pem) {
70  _client_certificate_pem = pem;
71  _client_certificate_filename = Filename();
72  unload_client_certificate();
73 }
74 
75 ////////////////////////////////////////////////////////////////////
76 // Function: HTTPClient::set_client_certificate_passphrase
77 // Access: Published
78 // Description: Sets the passphrase used to decrypt the private key
79 // in the certificate named by
80 // set_client_certificate_filename() or
81 // set_client_certificate_pem().
82 ////////////////////////////////////////////////////////////////////
83 INLINE void HTTPClient::
84 set_client_certificate_passphrase(const string &passphrase) {
85  _client_certificate_passphrase = passphrase;
86  unload_client_certificate();
87 }
88 
89 ////////////////////////////////////////////////////////////////////
90 // Function: HTTPClient::set_http_version
91 // Access: Published
92 // Description: Specifies the version of HTTP that the client uses to
93 // identify itself to the server. The default is HV_11,
94 // or HTTP 1.0; you can set this to HV_10 (HTTP 1.0) to
95 // request the server use the older interface.
96 ////////////////////////////////////////////////////////////////////
97 INLINE void HTTPClient::
98 set_http_version(HTTPEnum::HTTPVersion version) {
99  _http_version = version;
100 }
101 
102 ////////////////////////////////////////////////////////////////////
103 // Function: HTTPClient::get_http_version
104 // Access: Published
105 // Description: Returns the client's current setting for HTTP
106 // version. See set_http_version().
107 ////////////////////////////////////////////////////////////////////
108 INLINE HTTPEnum::HTTPVersion HTTPClient::
109 get_http_version() const {
110  return _http_version;
111 }
112 
113 ////////////////////////////////////////////////////////////////////
114 // Function: HTTPClient::set_verify_ssl
115 // Access: Published
116 // Description: Specifies whether the client will insist on verifying
117 // the identity of the servers it connects to via SSL
118 // (that is, https).
119 //
120 // The parameter value is an enumerated type which
121 // indicates the level of security to which the client
122 // will insist upon.
123 ////////////////////////////////////////////////////////////////////
124 INLINE void HTTPClient::
125 set_verify_ssl(HTTPClient::VerifySSL verify_ssl) {
126  _verify_ssl = verify_ssl;
127 }
128 
129 ////////////////////////////////////////////////////////////////////
130 // Function: HTTPClient::get_verify_ssl
131 // Access: Published
132 // Description: Returns whether the client will insist on verifying
133 // the identity of the servers it connects to via SSL
134 // (that is, https). See set_verify_ssl().
135 ////////////////////////////////////////////////////////////////////
136 INLINE HTTPClient::VerifySSL HTTPClient::
137 get_verify_ssl() const {
138  return _verify_ssl;
139 }
140 
141 ////////////////////////////////////////////////////////////////////
142 // Function: HTTPClient::set_cipher_list
143 // Access: Published
144 // Description: Specifies the set of ciphers that are to be made
145 // available for SSL connections. This is a string as
146 // described in the ciphers(1) man page of the OpenSSL
147 // documentation (or see
148 // http://www.openssl.org/docs/apps/ciphers.html ). If
149 // this is not specified, the default is provided by the
150 // Config file. You may also specify "DEFAULT" to use
151 // the built-in OpenSSL default value.
152 ////////////////////////////////////////////////////////////////////
153 INLINE void HTTPClient::
154 set_cipher_list(const string &cipher_list) {
155  _cipher_list = cipher_list;
156 }
157 
158 ////////////////////////////////////////////////////////////////////
159 // Function: HTTPClient::get_cipher_list
160 // Access: Published
161 // Description: Returns the set of ciphers as set by
162 // set_cipher_list(). See set_cipher_list().
163 ////////////////////////////////////////////////////////////////////
164 INLINE const string &HTTPClient::
165 get_cipher_list() const {
166  return _cipher_list;
167 }
168 
169 ////////////////////////////////////////////////////////////////////
170 // Function: HTTPClient::base64_encode
171 // Access: Published, Static
172 // Description: Implements HTTPAuthorization::base64_encode(). This
173 // is provided here just as a convenient place to
174 // publish it for access by the scripting language; C++
175 // code should probably use HTTPAuthorization directly.
176 ////////////////////////////////////////////////////////////////////
177 INLINE string HTTPClient::
178 base64_encode(const string &s) {
179  return HTTPAuthorization::base64_encode(s);
180 }
181 
182 ////////////////////////////////////////////////////////////////////
183 // Function: HTTPClient::base64_decode
184 // Access: Published, Static
185 // Description: Implements HTTPAuthorization::base64_decode(). This
186 // is provided here just as a convenient place to
187 // publish it for access by the scripting language; C++
188 // code should probably use HTTPAuthorization directly.
189 ////////////////////////////////////////////////////////////////////
190 INLINE string HTTPClient::
191 base64_decode(const string &s) {
192  return HTTPAuthorization::base64_decode(s);
193 }
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44