Panda3D
|
00001 // Filename: httpClient.I 00002 // Created by: drose (24Sep02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: HTTPClient::set_try_all_direct 00018 // Access: Published 00019 // Description: If this is set true, then after a connection attempt 00020 // through a proxy fails, we always try a direct 00021 // connection, regardless of whether the host is listed 00022 // on the direct_host_spec list. If this is false, a 00023 // direct attempt is not made when we have a proxy in 00024 // effect, even if the proxy fails. 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE void HTTPClient:: 00027 set_try_all_direct(bool try_all_direct) { 00028 _try_all_direct = try_all_direct; 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: HTTPClient::get_try_all_direct 00033 // Access: Published 00034 // Description: Returns whether a failed connection through a proxy 00035 // will be followed up by a direct connection attempt, 00036 // false otherwise. 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE bool HTTPClient:: 00039 get_try_all_direct() const { 00040 return _try_all_direct; 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: HTTPClient::set_client_certificate_filename 00045 // Access: Published 00046 // Description: Sets the filename of the pem-formatted file that will 00047 // be read for the client public and private keys if an 00048 // SSL server requests a certificate. Either this or 00049 // set_client_certificate_pem() may be used to specify a 00050 // client certificate. 00051 //////////////////////////////////////////////////////////////////// 00052 INLINE void HTTPClient:: 00053 set_client_certificate_filename(const Filename &filename) { 00054 _client_certificate_filename = filename; 00055 _client_certificate_pem = string(); 00056 unload_client_certificate(); 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: HTTPClient::set_client_certificate_pem 00061 // Access: Published 00062 // Description: Sets the pem-formatted contents of the certificate 00063 // that will be parsed for the client public and private 00064 // keys if an SSL server requests a certificate. Either 00065 // this or set_client_certificate_filename() may be used 00066 // to specify a client certificate. 00067 //////////////////////////////////////////////////////////////////// 00068 INLINE void HTTPClient:: 00069 set_client_certificate_pem(const string &pem) { 00070 _client_certificate_pem = pem; 00071 _client_certificate_filename = Filename(); 00072 unload_client_certificate(); 00073 } 00074 00075 //////////////////////////////////////////////////////////////////// 00076 // Function: HTTPClient::set_client_certificate_passphrase 00077 // Access: Published 00078 // Description: Sets the passphrase used to decrypt the private key 00079 // in the certificate named by 00080 // set_client_certificate_filename() or 00081 // set_client_certificate_pem(). 00082 //////////////////////////////////////////////////////////////////// 00083 INLINE void HTTPClient:: 00084 set_client_certificate_passphrase(const string &passphrase) { 00085 _client_certificate_passphrase = passphrase; 00086 unload_client_certificate(); 00087 } 00088 00089 //////////////////////////////////////////////////////////////////// 00090 // Function: HTTPClient::set_http_version 00091 // Access: Published 00092 // Description: Specifies the version of HTTP that the client uses to 00093 // identify itself to the server. The default is HV_11, 00094 // or HTTP 1.0; you can set this to HV_10 (HTTP 1.0) to 00095 // request the server use the older interface. 00096 //////////////////////////////////////////////////////////////////// 00097 INLINE void HTTPClient:: 00098 set_http_version(HTTPEnum::HTTPVersion version) { 00099 _http_version = version; 00100 } 00101 00102 //////////////////////////////////////////////////////////////////// 00103 // Function: HTTPClient::get_http_version 00104 // Access: Published 00105 // Description: Returns the client's current setting for HTTP 00106 // version. See set_http_version(). 00107 //////////////////////////////////////////////////////////////////// 00108 INLINE HTTPEnum::HTTPVersion HTTPClient:: 00109 get_http_version() const { 00110 return _http_version; 00111 } 00112 00113 //////////////////////////////////////////////////////////////////// 00114 // Function: HTTPClient::set_verify_ssl 00115 // Access: Published 00116 // Description: Specifies whether the client will insist on verifying 00117 // the identity of the servers it connects to via SSL 00118 // (that is, https). 00119 // 00120 // The parameter value is an enumerated type which 00121 // indicates the level of security to which the client 00122 // will insist upon. 00123 //////////////////////////////////////////////////////////////////// 00124 INLINE void HTTPClient:: 00125 set_verify_ssl(HTTPClient::VerifySSL verify_ssl) { 00126 _verify_ssl = verify_ssl; 00127 } 00128 00129 //////////////////////////////////////////////////////////////////// 00130 // Function: HTTPClient::get_verify_ssl 00131 // Access: Published 00132 // Description: Returns whether the client will insist on verifying 00133 // the identity of the servers it connects to via SSL 00134 // (that is, https). See set_verify_ssl(). 00135 //////////////////////////////////////////////////////////////////// 00136 INLINE HTTPClient::VerifySSL HTTPClient:: 00137 get_verify_ssl() const { 00138 return _verify_ssl; 00139 } 00140 00141 //////////////////////////////////////////////////////////////////// 00142 // Function: HTTPClient::set_cipher_list 00143 // Access: Published 00144 // Description: Specifies the set of ciphers that are to be made 00145 // available for SSL connections. This is a string as 00146 // described in the ciphers(1) man page of the OpenSSL 00147 // documentation (or see 00148 // http://www.openssl.org/docs/apps/ciphers.html ). If 00149 // this is not specified, the default is provided by the 00150 // Config file. You may also specify "DEFAULT" to use 00151 // the built-in OpenSSL default value. 00152 //////////////////////////////////////////////////////////////////// 00153 INLINE void HTTPClient:: 00154 set_cipher_list(const string &cipher_list) { 00155 _cipher_list = cipher_list; 00156 } 00157 00158 //////////////////////////////////////////////////////////////////// 00159 // Function: HTTPClient::get_cipher_list 00160 // Access: Published 00161 // Description: Returns the set of ciphers as set by 00162 // set_cipher_list(). See set_cipher_list(). 00163 //////////////////////////////////////////////////////////////////// 00164 INLINE const string &HTTPClient:: 00165 get_cipher_list() const { 00166 return _cipher_list; 00167 } 00168 00169 //////////////////////////////////////////////////////////////////// 00170 // Function: HTTPClient::base64_encode 00171 // Access: Published, Static 00172 // Description: Implements HTTPAuthorization::base64_encode(). This 00173 // is provided here just as a convenient place to 00174 // publish it for access by the scripting language; C++ 00175 // code should probably use HTTPAuthorization directly. 00176 //////////////////////////////////////////////////////////////////// 00177 INLINE string HTTPClient:: 00178 base64_encode(const string &s) { 00179 return HTTPAuthorization::base64_encode(s); 00180 } 00181 00182 //////////////////////////////////////////////////////////////////// 00183 // Function: HTTPClient::base64_decode 00184 // Access: Published, Static 00185 // Description: Implements HTTPAuthorization::base64_decode(). This 00186 // is provided here just as a convenient place to 00187 // publish it for access by the scripting language; C++ 00188 // code should probably use HTTPAuthorization directly. 00189 //////////////////////////////////////////////////////////////////// 00190 INLINE string HTTPClient:: 00191 base64_decode(const string &s) { 00192 return HTTPAuthorization::base64_decode(s); 00193 }