18 #include "pandabase.h"
28 #include "httpAuthorization.h"
30 #include "httpCookie.h"
31 #include "globPattern.h"
32 #include "pointerTo.h"
36 #include "referenceCount.h"
37 #include "openSSLWrapper.h"
60 HTTPClient(
const HTTPClient ©);
61 void operator = (
const HTTPClient ©);
64 static void init_random_seed();
66 void set_proxy_spec(
const string &proxy_spec);
67 string get_proxy_spec()
const;
69 void set_direct_host_spec(
const string &direct_host_spec);
70 string get_direct_host_spec()
const;
72 INLINE
void set_try_all_direct(
bool try_all_direct);
73 INLINE
bool get_try_all_direct()
const;
76 void add_proxy(
const string &scheme,
const URLSpec &proxy);
77 void clear_direct_host();
78 void add_direct_host(
const string &hostname);
81 string get_proxies_for_url(
const URLSpec &url)
const;
83 void set_username(
const string &server,
const string &realm,
const string &username);
84 string get_username(
const string &server,
const string &realm)
const;
86 void set_cookie(
const HTTPCookie &cookie);
87 bool clear_cookie(
const HTTPCookie &cookie);
88 void clear_all_cookies();
89 bool has_cookie(
const HTTPCookie &cookie)
const;
90 HTTPCookie get_cookie(
const HTTPCookie &cookie)
const;
91 void copy_cookies_from(
const HTTPClient &other);
93 void write_cookies(ostream &out)
const;
94 void send_cookies(ostream &out,
const URLSpec &url);
96 INLINE
void set_client_certificate_filename(
const Filename &filename);
97 INLINE
void set_client_certificate_pem(
const string &pem);
98 INLINE
void set_client_certificate_passphrase(
const string &passphrase);
99 bool load_client_certificate();
101 bool add_preapproved_server_certificate_filename(
const URLSpec &url,
const Filename &filename);
102 bool add_preapproved_server_certificate_pem(
const URLSpec &url,
const string &pem);
103 bool add_preapproved_server_certificate_name(
const URLSpec &url,
const string &name);
104 void clear_preapproved_server_certificates(
const URLSpec &url);
105 void clear_all_preapproved_server_certificates();
107 INLINE
void set_http_version(HTTPEnum::HTTPVersion version);
108 INLINE HTTPEnum::HTTPVersion get_http_version()
const;
109 string get_http_version_string()
const;
110 static HTTPEnum::HTTPVersion parse_http_version_string(
const string &version);
112 bool load_certificates(
const Filename &filename);
120 INLINE
void set_verify_ssl(VerifySSL verify_ssl);
121 INLINE VerifySSL get_verify_ssl()
const;
123 INLINE
void set_cipher_list(
const string &cipher_list);
124 INLINE
const string &get_cipher_list()
const;
126 PT(HTTPChannel) make_channel(
bool persistent_connection);
127 BLOCKING PT(HTTPChannel) post_form(const
URLSpec &url, const
string &body);
128 BLOCKING PT(HTTPChannel) get_document(const
URLSpec &url);
129 BLOCKING PT(HTTPChannel) get_header(const
URLSpec &url);
131 INLINE static
string base64_encode(const
string &s);
132 INLINE static
string base64_decode(const
string &s);
134 static HTTPClient *get_global_ptr();
137 SSL_CTX *get_ssl_ctx();
140 void check_preapproved_server_certificate(const
URLSpec &url, X509 *cert,
141 bool &cert_preapproved,
bool &cert_name_preapproved) const;
143 bool get_proxies_for_scheme(const
string &scheme,
146 void add_http_username(const
string &http_username);
147 string select_username(const
URLSpec &url,
bool is_proxy,
148 const
string &realm) const;
150 HTTPAuthorization *select_auth(const
URLSpec &url,
bool is_proxy,
151 const
string &last_realm);
152 PT(HTTPAuthorization) generate_auth(const
URLSpec &url,
bool is_proxy,
153 const
string &challenge);
155 void unload_client_certificate();
157 static X509_NAME *parse_x509_name(const
string &source);
158 static
bool x509_name_subset(X509_NAME *name_a, X509_NAME *name_b);
160 static
void split_whitespace(
string &a,
string &b, const
string &c);
162 #if defined(SSL_097) && !defined(NDEBUG)
163 static void ssl_msg_callback(
int write_p,
int version,
int content_type,
164 const void *buf,
size_t len, SSL *ssl,
170 ProxiesByScheme _proxies_by_scheme;
172 DirectHosts _direct_hosts;
173 bool _try_all_direct;
175 HTTPEnum::HTTPVersion _http_version;
176 VerifySSL _verify_ssl;
180 Usernames _usernames;
188 Domains _proxy_domains, _www_domains;
194 Filename _client_certificate_filename;
195 string _client_certificate_pem;
196 string _client_certificate_passphrase;
199 bool _client_certificate_loaded;
200 X509 *_client_certificate_pub;
201 EVP_PKEY *_client_certificate_priv;
205 class PreapprovedServerCert {
207 ~PreapprovedServerCert();
210 ServerCertNames _cert_names;
214 PreapprovedServerCerts _preapproved_server_certs;
216 static PT(HTTPClient) _global_ptr;
218 friend class HTTPChannel;
221 #include "httpClient.I"
223 #endif // HAVE_OPENSSL
This is our own Panda specialization on the default STL map.
A container for a URL, e.g.
This is our own Panda specialization on the default STL vector.
The name of a file, such as a texture file or an Egg file.
A base class for all things that want to be reference-counted.
This is our own Panda specialization on the default STL set.