mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
add URLSpec::is_ssl
This commit is contained in:
parent
4f6d41a4d2
commit
34dfb94e83
@ -1813,16 +1813,16 @@ begin_request(HTTPEnum::Method method, const DocumentSpec &url,
|
||||
|
||||
// An https-style request means we'll need to establish an SSL
|
||||
// connection.
|
||||
_want_ssl = (_request.get_url().get_scheme() == "https");
|
||||
_want_ssl = _request.get_url().is_ssl();
|
||||
|
||||
_proxy_tunnel = false;
|
||||
_proxy_serves_document = false;
|
||||
|
||||
if (!_proxy.empty()) {
|
||||
// If we're opening an SSL connection, or we ask for a direct
|
||||
// connection of some kind, or if we have a SOCKS-style proxy,
|
||||
// that demands a tunnel through the proxy to speak directly to
|
||||
// the http server.
|
||||
// If we're opening an SSL connection, or the user has explicitly
|
||||
// asked for a direct connection of some kind, or if we have a
|
||||
// SOCKS-style proxy; each of these demands a tunnel through the
|
||||
// proxy to speak directly to the http server.
|
||||
_proxy_tunnel =
|
||||
(_want_ssl || _method == HTTPEnum::M_connect || _proxy.get_scheme() == "socks");
|
||||
|
||||
|
@ -227,6 +227,28 @@ get_query() const {
|
||||
return _url.substr(_query_start);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: URLSpec::is_ssl
|
||||
// Access: Published
|
||||
// Description: Returns true if the URL's scheme specifies an
|
||||
// SSL-secured protocol such as https, or false
|
||||
// otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool URLSpec::
|
||||
is_ssl() const {
|
||||
if (has_scheme() && _scheme_end > 0) {
|
||||
// If we have a scheme specification, assume it is SSL-secured if
|
||||
// it ends in "s", except for the special case of "socks".
|
||||
if (_url.substr(0, _scheme_end) == "socks") {
|
||||
return false;
|
||||
}
|
||||
return (_url[_scheme_end - 1] == 's');
|
||||
}
|
||||
|
||||
// If we have no scheme specification, it's not SSL-secured.
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: URLSpec::get_url
|
||||
// Access: Published
|
||||
|
@ -60,6 +60,7 @@ PUBLISHED:
|
||||
string get_server_and_port() const;
|
||||
string get_path() const;
|
||||
INLINE string get_query() const;
|
||||
INLINE bool is_ssl() const;
|
||||
|
||||
INLINE const string &get_url() const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user