HTTPClient
from panda3d.core import HTTPClient
- class HTTPClient
Bases:
ReferenceCount
Handles contacting an HTTP server and retrieving a document. Each HTTPClient object represents a separate context, and stores its own list of cookies, passwords, and certificates; however, a given HTTPClient is capable of making multiple simultaneous requests to the same or different servers.
It is up to the programmer whether one HTTPClient should be used to retrieve all documents, or a separate one should be created each time. There is a default, global HTTPClient available in HTTPClient::get_global_ptr().
Inheritance diagram
- VSNoDateCheck = 1
- VSNoVerify = 0
- VSNormal = 2
- VS_no_date_check = 1
- VS_no_verify = 0
- VS_normal = 2
- __init__(*args, **kwargs)
- addDirectHost()
C++ Interface: add_direct_host(const HTTPClient self, str hostname)
- /**
Adds the indicated name to the set of hostnames that are connected to
directly, without using a proxy. This name may be either a DNS name or an
IP address, and it may include the * as a wildcard character.
*/
- addPreapprovedServerCertificateFilename()
C++ Interface: add_preapproved_server_certificate_filename(const HTTPClient self, const URLSpec url, const Filename filename)
- /**
Adds the certificate defined in the indicated PEM filename as a “pre-
approved” certificate for the indicated server, defined by the hostname and
port (only) from the given URL.
If the server offers this particular certificate on a secure connection, it
will be accepted without question. This is particularly useful for
communicating with a server using a known self-signed certificate.
See also the similar add_preapproved_server_certificate_pem(), and the
weaker add_preapproved_server_certificate_name().
*/
- addPreapprovedServerCertificateName()
C++ Interface: add_preapproved_server_certificate_name(const HTTPClient self, const URLSpec url, str name)
- /**
Adds the certificate name only, as a “pre-approved” certificate name for
the indicated server, defined by the hostname and port (only) from the
given URL.
This is a weaker function than
add_preapproved_server_certificate_filename(). This checks only the
subject name of the certificate, without checking for a particular
certificate by key. This means that a variety of server certificates may
match the indicated name.
Because this is a weaker verification, it only applies to server
certificates that are signed by a recognized certificate authority. Thus,
it cannot be used to pre-approve self-signed certificates, but it can be
used to accept a server certificate offered by a different hostname than
the one in the cert itself.
The certificate name should be formatted in the form
type0=value0/type1=value1/type2=…
*/
- addPreapprovedServerCertificatePem()
C++ Interface: add_preapproved_server_certificate_pem(const HTTPClient self, const URLSpec url, str pem)
- /**
Adds the certificate defined in the indicated data string, formatted as a
PEM block, as a “pre-approved” certificate for the indicated server,
defined by the hostname and port (only) from the given URL.
If the server offers this particular certificate on a secure connection, it
will be accepted without question. This is particularly useful for
communicating with a server using a known self-signed certificate.
See also the similar add_preapproved_server_certificate_filename(), and the
weaker add_preapproved_server_certificate_name().
*/
- addProxy()
C++ Interface: add_proxy(const HTTPClient self, str scheme, const URLSpec proxy)
- /**
Adds the indicated proxy host as a proxy for communications on the given
scheme. Usually the scheme is “http” or “https”. It may be the empty
string to indicate a general proxy. The proxy string may be the empty URL
to indicate a direct connection.
*/
- add_direct_host()
C++ Interface: add_direct_host(const HTTPClient self, str hostname)
- /**
Adds the indicated name to the set of hostnames that are connected to
directly, without using a proxy. This name may be either a DNS name or an
IP address, and it may include the * as a wildcard character.
*/
- add_preapproved_server_certificate_filename()
C++ Interface: add_preapproved_server_certificate_filename(const HTTPClient self, const URLSpec url, const Filename filename)
- /**
Adds the certificate defined in the indicated PEM filename as a “pre-
approved” certificate for the indicated server, defined by the hostname and
port (only) from the given URL.
If the server offers this particular certificate on a secure connection, it
will be accepted without question. This is particularly useful for
communicating with a server using a known self-signed certificate.
See also the similar add_preapproved_server_certificate_pem(), and the
weaker add_preapproved_server_certificate_name().
*/
- add_preapproved_server_certificate_name()
C++ Interface: add_preapproved_server_certificate_name(const HTTPClient self, const URLSpec url, str name)
- /**
Adds the certificate name only, as a “pre-approved” certificate name for
the indicated server, defined by the hostname and port (only) from the
given URL.
This is a weaker function than
add_preapproved_server_certificate_filename(). This checks only the
subject name of the certificate, without checking for a particular
certificate by key. This means that a variety of server certificates may
match the indicated name.
Because this is a weaker verification, it only applies to server
certificates that are signed by a recognized certificate authority. Thus,
it cannot be used to pre-approve self-signed certificates, but it can be
used to accept a server certificate offered by a different hostname than
the one in the cert itself.
The certificate name should be formatted in the form
type0=value0/type1=value1/type2=…
*/
- add_preapproved_server_certificate_pem()
C++ Interface: add_preapproved_server_certificate_pem(const HTTPClient self, const URLSpec url, str pem)
- /**
Adds the certificate defined in the indicated data string, formatted as a
PEM block, as a “pre-approved” certificate for the indicated server,
defined by the hostname and port (only) from the given URL.
If the server offers this particular certificate on a secure connection, it
will be accepted without question. This is particularly useful for
communicating with a server using a known self-signed certificate.
See also the similar add_preapproved_server_certificate_filename(), and the
weaker add_preapproved_server_certificate_name().
*/
- add_proxy()
C++ Interface: add_proxy(const HTTPClient self, str scheme, const URLSpec proxy)
- /**
Adds the indicated proxy host as a proxy for communications on the given
scheme. Usually the scheme is “http” or “https”. It may be the empty
string to indicate a general proxy. The proxy string may be the empty URL
to indicate a direct connection.
*/
- assign()
C++ Interface: assign(const HTTPClient self, const HTTPClient copy)
- base64Decode()
C++ Interface: base64_decode(str s)
- /**
Implements HTTPAuthorization::base64_decode(). This is provided here just
as a convenient place to publish it for access by the scripting language;
C++ code should probably use HTTPAuthorization directly.
*/
- base64Encode()
C++ Interface: base64_encode(str s)
- /**
Implements HTTPAuthorization::base64_encode(). This is provided here just
as a convenient place to publish it for access by the scripting language;
C++ code should probably use HTTPAuthorization directly.
*/
- base64_decode()
C++ Interface: base64_decode(str s)
- /**
Implements HTTPAuthorization::base64_decode(). This is provided here just
as a convenient place to publish it for access by the scripting language;
C++ code should probably use HTTPAuthorization directly.
*/
- base64_encode()
C++ Interface: base64_encode(str s)
- /**
Implements HTTPAuthorization::base64_encode(). This is provided here just
as a convenient place to publish it for access by the scripting language;
C++ code should probably use HTTPAuthorization directly.
*/
- clearAllCookies()
C++ Interface: clear_all_cookies(const HTTPClient self)
- /**
Removes the all stored cookies from the client.
*/
- clearAllPreapprovedServerCertificates()
C++ Interface: clear_all_preapproved_server_certificates(const HTTPClient self)
- /**
Removes all preapproved server certificates for all servers.
*/
- clearCookie()
C++ Interface: clear_cookie(const HTTPClient self, const HTTPCookie cookie)
- /**
Removes the cookie with the matching domain/path/name from the client’s
list of cookies. Returns true if it was removed, false if the cookie was
not matched.
*/
- clearDirectHost()
C++ Interface: clear_direct_host(const HTTPClient self)
- /**
Resets the set of direct hosts to empty. Subsequent calls to
add_direct_host() may be made to build up the list of hosts that do not
require a proxy connection.
*/
- clearPreapprovedServerCertificates()
C++ Interface: clear_preapproved_server_certificates(const HTTPClient self, const URLSpec url)
- /**
Removes all preapproved server certificates for the indicated server and
port.
*/
- clearProxy()
C++ Interface: clear_proxy(const HTTPClient self)
- /**
Resets the proxy spec to empty. Subsequent calls to add_proxy() may be
made to build up the set of proxy servers.
*/
- clear_all_cookies()
C++ Interface: clear_all_cookies(const HTTPClient self)
- /**
Removes the all stored cookies from the client.
*/
- clear_all_preapproved_server_certificates()
C++ Interface: clear_all_preapproved_server_certificates(const HTTPClient self)
- /**
Removes all preapproved server certificates for all servers.
*/
- clear_cookie()
C++ Interface: clear_cookie(const HTTPClient self, const HTTPCookie cookie)
- /**
Removes the cookie with the matching domain/path/name from the client’s
list of cookies. Returns true if it was removed, false if the cookie was
not matched.
*/
- clear_direct_host()
C++ Interface: clear_direct_host(const HTTPClient self)
- /**
Resets the set of direct hosts to empty. Subsequent calls to
add_direct_host() may be made to build up the list of hosts that do not
require a proxy connection.
*/
- clear_preapproved_server_certificates()
C++ Interface: clear_preapproved_server_certificates(const HTTPClient self, const URLSpec url)
- /**
Removes all preapproved server certificates for the indicated server and
port.
*/
- clear_proxy()
C++ Interface: clear_proxy(const HTTPClient self)
- /**
Resets the proxy spec to empty. Subsequent calls to add_proxy() may be
made to build up the set of proxy servers.
*/
- copyCookiesFrom()
C++ Interface: copy_cookies_from(const HTTPClient self, const HTTPClient other)
- /**
Copies all the cookies from the indicated HTTPClient into this one.
Existing cookies in this client are not affected, unless they are shadowed
by the new cookies.
*/
- copy_cookies_from()
C++ Interface: copy_cookies_from(const HTTPClient self, const HTTPClient other)
- /**
Copies all the cookies from the indicated HTTPClient into this one.
Existing cookies in this client are not affected, unless they are shadowed
by the new cookies.
*/
- getCipherList()
C++ Interface: get_cipher_list(HTTPClient self)
- /**
Returns the set of ciphers as set by set_cipher_list(). See
set_cipher_list().
*/
- getCookie()
C++ Interface: get_cookie(HTTPClient self, const HTTPCookie cookie)
- /**
Looks up and returns the cookie in the client matching the given cookie’s
domain/path/name. If there is no matching cookie, returns an empty cookie.
*/
- getDirectHostSpec()
C++ Interface: get_direct_host_spec(HTTPClient self)
- /**
Returns the set of hosts that should be connected to directly, without
using a proxy, as a semicolon-separated list of hostnames that may contain
wildcard characters (“*”).
*/
- getDocument()
C++ Interface: get_document(const HTTPClient self, const URLSpec url)
- /**
Opens the named document for reading. Returns a new HTTPChannel object
whether the document is successfully read or not; you can test is_valid()
and get_return_code() to determine whether the document was retrieved.
*/
- getHeader()
C++ Interface: get_header(const HTTPClient self, const URLSpec url)
- /**
Like get_document(), except only the header associated with the document is
retrieved. This may be used to test for existence of the document; it
might also return the size of the document (if the server gives us this
information).
*/
- getHttpVersion()
C++ Interface: get_http_version(HTTPClient self)
- /**
Returns the client’s current setting for HTTP version. See
set_http_version().
*/
- getHttpVersionString()
C++ Interface: get_http_version_string(HTTPClient self)
- /**
Returns the current HTTP version setting as a string, e.g. “HTTP/1.0” or
“HTTP/1.1”.
*/
- getProxiesForUrl()
C++ Interface: get_proxies_for_url(HTTPClient self, const URLSpec url)
- /**
Fills up the indicated vector with the list of URLSpec objects, in the
order in which they should be tried, that are appropriate proxies to try
for the indicated URL. The empty URL is returned for a direct connection.
It is the user’s responsibility to empty this vector before calling this
method; otherwise, the proxy URL’s will simply be appended to the existing
list.
*/
- /**
Returns a semicolon-delimited list of proxies, in the order in which they
should be tried, that are appropriate for the indicated URL. The keyword
DIRECT indicates a direct connection should be tried.
*/
- getProxySpec()
C++ Interface: get_proxy_spec(HTTPClient self)
- /**
Returns the complete set of proxies to use for all schemes. This is a
string of the form specified by set_proxy_spec(), above. Note that the
string returned by this function may not be exactly the same as the string
passed into set_proxy_spec(), since the string is regenerated from the
internal storage structures and may therefore be reordered.
*/
- getTryAllDirect()
C++ Interface: get_try_all_direct(HTTPClient self)
- /**
Returns whether a failed connection through a proxy will be followed up by
a direct connection attempt, false otherwise.
*/
- getUsername()
C++ Interface: get_username(HTTPClient self, str server, str realm)
- /**
Returns the username:password string set for this server/realm pair, or
empty string if nothing has been set. See set_username().
*/
- getVerifySsl()
C++ Interface: get_verify_ssl(HTTPClient self)
- /**
Returns whether the client will insist on verifying the identity of the
servers it connects to via SSL (that is, https). See set_verify_ssl().
*/
- get_cipher_list()
C++ Interface: get_cipher_list(HTTPClient self)
- /**
Returns the set of ciphers as set by set_cipher_list(). See
set_cipher_list().
*/
- get_cookie()
C++ Interface: get_cookie(HTTPClient self, const HTTPCookie cookie)
- /**
Looks up and returns the cookie in the client matching the given cookie’s
domain/path/name. If there is no matching cookie, returns an empty cookie.
*/
- get_direct_host_spec()
C++ Interface: get_direct_host_spec(HTTPClient self)
- /**
Returns the set of hosts that should be connected to directly, without
using a proxy, as a semicolon-separated list of hostnames that may contain
wildcard characters (“*”).
*/
- get_document()
C++ Interface: get_document(const HTTPClient self, const URLSpec url)
- /**
Opens the named document for reading. Returns a new HTTPChannel object
whether the document is successfully read or not; you can test is_valid()
and get_return_code() to determine whether the document was retrieved.
*/
- get_header()
C++ Interface: get_header(const HTTPClient self, const URLSpec url)
- /**
Like get_document(), except only the header associated with the document is
retrieved. This may be used to test for existence of the document; it
might also return the size of the document (if the server gives us this
information).
*/
- get_http_version()
C++ Interface: get_http_version(HTTPClient self)
- /**
Returns the client’s current setting for HTTP version. See
set_http_version().
*/
- get_http_version_string()
C++ Interface: get_http_version_string(HTTPClient self)
- /**
Returns the current HTTP version setting as a string, e.g. “HTTP/1.0” or
“HTTP/1.1”.
*/
- get_proxies_for_url()
C++ Interface: get_proxies_for_url(HTTPClient self, const URLSpec url)
- /**
Fills up the indicated vector with the list of URLSpec objects, in the
order in which they should be tried, that are appropriate proxies to try
for the indicated URL. The empty URL is returned for a direct connection.
It is the user’s responsibility to empty this vector before calling this
method; otherwise, the proxy URL’s will simply be appended to the existing
list.
*/
- /**
Returns a semicolon-delimited list of proxies, in the order in which they
should be tried, that are appropriate for the indicated URL. The keyword
DIRECT indicates a direct connection should be tried.
*/
- get_proxy_spec()
C++ Interface: get_proxy_spec(HTTPClient self)
- /**
Returns the complete set of proxies to use for all schemes. This is a
string of the form specified by set_proxy_spec(), above. Note that the
string returned by this function may not be exactly the same as the string
passed into set_proxy_spec(), since the string is regenerated from the
internal storage structures and may therefore be reordered.
*/
- get_try_all_direct()
C++ Interface: get_try_all_direct(HTTPClient self)
- /**
Returns whether a failed connection through a proxy will be followed up by
a direct connection attempt, false otherwise.
*/
- get_username()
C++ Interface: get_username(HTTPClient self, str server, str realm)
- /**
Returns the username:password string set for this server/realm pair, or
empty string if nothing has been set. See set_username().
*/
- get_verify_ssl()
C++ Interface: get_verify_ssl(HTTPClient self)
- /**
Returns whether the client will insist on verifying the identity of the
servers it connects to via SSL (that is, https). See set_verify_ssl().
*/
- hasCookie()
C++ Interface: has_cookie(HTTPClient self, const HTTPCookie cookie)
- /**
Returns true if there is a cookie in the client matching the given cookie’s
domain/path/name, false otherwise.
*/
- has_cookie()
C++ Interface: has_cookie(HTTPClient self, const HTTPCookie cookie)
- /**
Returns true if there is a cookie in the client matching the given cookie’s
domain/path/name, false otherwise.
*/
- initRandomSeed()
C++ Interface: init_random_seed()
- /**
This may be called once, presumably at the beginning of an application, to
initialize OpenSSL’s random seed. On Windows, it is particularly important
to call this at startup if you are going to be performing any https
operations or otherwise use encryption, since the Windows algorithm for
getting a random seed takes 2-3 seconds at startup, but can take 30 seconds
or more after you have opened a 3-D graphics window and started rendering.
There is no harm in calling this method multiple times, or in not calling
it at all.
*/
- init_random_seed()
C++ Interface: init_random_seed()
- /**
This may be called once, presumably at the beginning of an application, to
initialize OpenSSL’s random seed. On Windows, it is particularly important
to call this at startup if you are going to be performing any https
operations or otherwise use encryption, since the Windows algorithm for
getting a random seed takes 2-3 seconds at startup, but can take 30 seconds
or more after you have opened a 3-D graphics window and started rendering.
There is no harm in calling this method multiple times, or in not calling
it at all.
*/
- loadCertificates()
C++ Interface: load_certificates(const HTTPClient self, const Filename filename)
- /**
Reads the certificate(s) (delimited by —–BEGIN CERTIFICATE—– and
—–END CERTIFICATE—–) from the indicated file and makes them known as
trusted public keys for validating future connections. Returns true on
success, false otherwise.
*/
- loadClientCertificate()
C++ Interface: load_client_certificate(const HTTPClient self)
- /**
Attempts to load the certificate named by set_client_certificate_filename()
immediately, and returns true if successful, false otherwise.
Normally this need not be explicitly called, since it will be called
automatically if the server requests a certificate, but it may be useful to
determine ahead of time if the certificate can be loaded correctly.
*/
- load_certificates()
C++ Interface: load_certificates(const HTTPClient self, const Filename filename)
- /**
Reads the certificate(s) (delimited by —–BEGIN CERTIFICATE—– and
—–END CERTIFICATE—–) from the indicated file and makes them known as
trusted public keys for validating future connections. Returns true on
success, false otherwise.
*/
- load_client_certificate()
C++ Interface: load_client_certificate(const HTTPClient self)
- /**
Attempts to load the certificate named by set_client_certificate_filename()
immediately, and returns true if successful, false otherwise.
Normally this need not be explicitly called, since it will be called
automatically if the server requests a certificate, but it may be useful to
determine ahead of time if the certificate can be loaded correctly.
*/
- makeChannel()
C++ Interface: make_channel(const HTTPClient self, bool persistent_connection)
- /**
Returns a new HTTPChannel object that may be used for reading multiple
documents using the same connection, for greater network efficiency than
calling HTTPClient::get_document() repeatedly (which would force a new
connection for each document).
Also, HTTPChannel has some additional, less common interface methods than
the basic interface methods that exist on HTTPClient; if you wish to call
any of these methods you must first obtain an HTTPChannel.
Pass true for persistent_connection to gain this network efficiency. If,
on the other hand, your intention is to use the channel to retrieve only
one document, then pass false to inform the server that we will be dropping
the connection after the first document.
*/
- make_channel()
C++ Interface: make_channel(const HTTPClient self, bool persistent_connection)
- /**
Returns a new HTTPChannel object that may be used for reading multiple
documents using the same connection, for greater network efficiency than
calling HTTPClient::get_document() repeatedly (which would force a new
connection for each document).
Also, HTTPChannel has some additional, less common interface methods than
the basic interface methods that exist on HTTPClient; if you wish to call
any of these methods you must first obtain an HTTPChannel.
Pass true for persistent_connection to gain this network efficiency. If,
on the other hand, your intention is to use the channel to retrieve only
one document, then pass false to inform the server that we will be dropping
the connection after the first document.
*/
- parseHttpVersionString()
C++ Interface: parse_http_version_string(str version)
- /**
Matches the string representing a particular HTTP version against any of
the known versions and returns the appropriate enumerated value, or
HV_other if the version is unknown.
*/
- parse_http_version_string()
C++ Interface: parse_http_version_string(str version)
- /**
Matches the string representing a particular HTTP version against any of
the known versions and returns the appropriate enumerated value, or
HV_other if the version is unknown.
*/
- postForm()
C++ Interface: post_form(const HTTPClient self, const URLSpec url, str body)
- /**
Posts form data to a particular URL and retrieves the response. Returns a
new HTTPChannel object whether the document is successfully read or not;
you can test is_valid() and get_return_code() to determine whether the
document was retrieved.
*/
- post_form()
C++ Interface: post_form(const HTTPClient self, const URLSpec url, str body)
- /**
Posts form data to a particular URL and retrieves the response. Returns a
new HTTPChannel object whether the document is successfully read or not;
you can test is_valid() and get_return_code() to determine whether the
document was retrieved.
*/
- sendCookies()
C++ Interface: send_cookies(const HTTPClient self, ostream out, const URLSpec url)
- /**
Writes to the indicated ostream a “Cookie” header line for sending the
cookies appropriate to the indicated URL along with an HTTP request. This
also removes expired cookies.
*/
- send_cookies()
C++ Interface: send_cookies(const HTTPClient self, ostream out, const URLSpec url)
- /**
Writes to the indicated ostream a “Cookie” header line for sending the
cookies appropriate to the indicated URL along with an HTTP request. This
also removes expired cookies.
*/
- setCipherList()
C++ Interface: set_cipher_list(const HTTPClient self, str cipher_list)
- /**
Specifies the set of ciphers that are to be made available for SSL
connections. This is a string as described in the ciphers(1) man page of
the OpenSSL documentation (or see
https://www.openssl.org/docs/man1.1.1/man1/ciphers.html ). If this isn’t
specified, the default is provided by the Config file. You may also specify
“DEFAULT” to use the built-in OpenSSL default value.
*/
- setClientCertificateFilename()
C++ Interface: set_client_certificate_filename(const HTTPClient self, const Filename filename)
- /**
Sets the filename of the pem-formatted file that will be read for the
client public and private keys if an SSL server requests a certificate.
Either this or set_client_certificate_pem() may be used to specify a client
certificate.
*/
- setClientCertificatePassphrase()
C++ Interface: set_client_certificate_passphrase(const HTTPClient self, str passphrase)
- /**
Sets the passphrase used to decrypt the private key in the certificate
named by set_client_certificate_filename() or set_client_certificate_pem().
*/
- setClientCertificatePem()
C++ Interface: set_client_certificate_pem(const HTTPClient self, str pem)
- /**
Sets the pem-formatted contents of the certificate that will be parsed for
the client public and private keys if an SSL server requests a certificate.
Either this or set_client_certificate_filename() may be used to specify a
client certificate.
*/
- setCookie()
C++ Interface: set_cookie(const HTTPClient self, const HTTPCookie cookie)
- /**
Stores the indicated cookie in the client’s list of cookies, as if it had
been received from a server.
*/
- setDirectHostSpec()
C++ Interface: set_direct_host_spec(const HTTPClient self, str direct_host_spec)
- /**
Specifies the set of hosts that should be connected to directly, without
using a proxy. This is a semicolon-separated list of hostnames that may
contain wildcard characters (“*”).
*/
- setHttpVersion()
C++ Interface: set_http_version(const HTTPClient self, int version)
- /**
Specifies the version of HTTP that the client uses to identify itself to
the server. The default is HV_11, or HTTP 1.0; you can set this to HV_10
(HTTP 1.0) to request the server use the older interface.
*/
- setProxySpec()
C++ Interface: set_proxy_spec(const HTTPClient self, str proxy_spec)
- /**
Specifies the complete set of proxies to use for all schemes. This is
either a semicolon-delimited set of hostname:ports, or a semicolon-
delimited set of pairs of the form “scheme=hostname:port”, or a
combination. Use the keyword DIRECT, or an empty string, to represent a
direct connection. A particular scheme and/or proxy host may be listed
more than once. This is a convenience function that can be used in place
of explicit calls to add_proxy() for each scheme/proxy pair.
*/
- setTryAllDirect()
C++ Interface: set_try_all_direct(const HTTPClient self, bool try_all_direct)
- /**
If this is set true, then after a connection attempt through a proxy fails,
we always try a direct connection, regardless of whether the host is listed
on the direct_host_spec list. If this is false, a direct attempt is not
made when we have a proxy in effect, even if the proxy fails.
*/
- setUsername()
C++ Interface: set_username(const HTTPClient self, str server, str realm, str username)
- /**
Specifies the username:password string corresponding to a particular server
and/or realm, when demanded by the server. Either or both of the server or
realm may be empty; if so, they match anything. Also, the server may be
set to the special string “*proxy”, which will match any proxy server.
If the username is set to the empty string, this clears the password for
the particular server/realm pair.
*/
- setVerifySsl()
C++ Interface: set_verify_ssl(const HTTPClient self, int verify_ssl)
- /**
Specifies whether the client will insist on verifying the identity of the
servers it connects to via SSL (that is, https).
The parameter value is an enumerated type which indicates the level of
security to which the client will insist upon.
*/
- set_cipher_list()
C++ Interface: set_cipher_list(const HTTPClient self, str cipher_list)
- /**
Specifies the set of ciphers that are to be made available for SSL
connections. This is a string as described in the ciphers(1) man page of
the OpenSSL documentation (or see
https://www.openssl.org/docs/man1.1.1/man1/ciphers.html ). If this isn’t
specified, the default is provided by the Config file. You may also specify
“DEFAULT” to use the built-in OpenSSL default value.
*/
- set_client_certificate_filename()
C++ Interface: set_client_certificate_filename(const HTTPClient self, const Filename filename)
- /**
Sets the filename of the pem-formatted file that will be read for the
client public and private keys if an SSL server requests a certificate.
Either this or set_client_certificate_pem() may be used to specify a client
certificate.
*/
- set_client_certificate_passphrase()
C++ Interface: set_client_certificate_passphrase(const HTTPClient self, str passphrase)
- /**
Sets the passphrase used to decrypt the private key in the certificate
named by set_client_certificate_filename() or set_client_certificate_pem().
*/
- set_client_certificate_pem()
C++ Interface: set_client_certificate_pem(const HTTPClient self, str pem)
- /**
Sets the pem-formatted contents of the certificate that will be parsed for
the client public and private keys if an SSL server requests a certificate.
Either this or set_client_certificate_filename() may be used to specify a
client certificate.
*/
- set_cookie()
C++ Interface: set_cookie(const HTTPClient self, const HTTPCookie cookie)
- /**
Stores the indicated cookie in the client’s list of cookies, as if it had
been received from a server.
*/
- set_direct_host_spec()
C++ Interface: set_direct_host_spec(const HTTPClient self, str direct_host_spec)
- /**
Specifies the set of hosts that should be connected to directly, without
using a proxy. This is a semicolon-separated list of hostnames that may
contain wildcard characters (“*”).
*/
- set_http_version()
C++ Interface: set_http_version(const HTTPClient self, int version)
- /**
Specifies the version of HTTP that the client uses to identify itself to
the server. The default is HV_11, or HTTP 1.0; you can set this to HV_10
(HTTP 1.0) to request the server use the older interface.
*/
- set_proxy_spec()
C++ Interface: set_proxy_spec(const HTTPClient self, str proxy_spec)
- /**
Specifies the complete set of proxies to use for all schemes. This is
either a semicolon-delimited set of hostname:ports, or a semicolon-
delimited set of pairs of the form “scheme=hostname:port”, or a
combination. Use the keyword DIRECT, or an empty string, to represent a
direct connection. A particular scheme and/or proxy host may be listed
more than once. This is a convenience function that can be used in place
of explicit calls to add_proxy() for each scheme/proxy pair.
*/
- set_try_all_direct()
C++ Interface: set_try_all_direct(const HTTPClient self, bool try_all_direct)
- /**
If this is set true, then after a connection attempt through a proxy fails,
we always try a direct connection, regardless of whether the host is listed
on the direct_host_spec list. If this is false, a direct attempt is not
made when we have a proxy in effect, even if the proxy fails.
*/
- set_username()
C++ Interface: set_username(const HTTPClient self, str server, str realm, str username)
- /**
Specifies the username:password string corresponding to a particular server
and/or realm, when demanded by the server. Either or both of the server or
realm may be empty; if so, they match anything. Also, the server may be
set to the special string “*proxy”, which will match any proxy server.
If the username is set to the empty string, this clears the password for
the particular server/realm pair.
*/
- set_verify_ssl()
C++ Interface: set_verify_ssl(const HTTPClient self, int verify_ssl)
- /**
Specifies whether the client will insist on verifying the identity of the
servers it connects to via SSL (that is, https).
The parameter value is an enumerated type which indicates the level of
security to which the client will insist upon.
*/