Permalink
Browse files

http/Request: Add is_secure method

  • Loading branch information...
sconemad committed Jun 3, 2017
1 parent 989dc8f commit 0d6a517a735857e3d8dae4bce8159a57d89057de
Showing with 8 additions and 0 deletions.
  1. +7 −0 http/Request.cpp
  2. +1 −0 http/Request.h
@@ -70,6 +70,12 @@ const scx::Uri& Request::get_uri() const
return m_uri;
}

//===========================================================================
bool Request::is_secure() const
{
return (m_uri.get_scheme() == "https");
}

//===========================================================================
void Request::set_version(const scx::VersionTag& ver)
{
@@ -328,6 +334,7 @@ scx::ScriptRef* Request::script_op(const scx::ScriptAuth& auth,
if (name == "user") return scx::ScriptString::new_ref(m_auth_user);
if (name == "method") return scx::ScriptString::new_ref(m_method);
if (name == "uri") return new scx::ScriptRef(m_uri.new_copy());
if (name == "secure") return scx::ScriptBool::new_ref(is_secure());
if (name == "version") return new scx::ScriptRef(m_version.new_copy());
if (name == "id") return scx::ScriptString::new_ref(m_id);
if (name == "params")
@@ -46,6 +46,7 @@ class HTTP_API Request : public scx::ScriptObject {

void set_uri(const scx::Uri& uri);
const scx::Uri& get_uri() const;
bool is_secure() const;

void set_version(const scx::VersionTag& ver);
const scx::VersionTag& get_version() const;

0 comments on commit 0d6a517

Please sign in to comment.