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