コード例 #1
0
ファイル: accessors.hpp プロジェクト: godexsoft/pushy
inline
uri::string_type decoded_fragment(const uri &uri_) {
    const uri::string_type fragment = uri_.fragment();
    uri::string_type decoded_fragment;
    decode(fragment, std::back_inserter(decoded_fragment));
    return decoded_fragment;
}
コード例 #2
0
ファイル: uri.cpp プロジェクト: PKRoma/cpprestsdk
bool uri::operator == (const uri &other) const
{
    // Each individual URI component must be decoded before performing comparison.
    // TFS # 375865

    if (this->is_empty() && other.is_empty())
    {
        return true;
    }
    else if (this->is_empty() || other.is_empty())
    {
        return false;
    }
    else if (this->scheme() != other.scheme())
    {
        // scheme is canonicalized to lowercase
        return false;
    }
    else if(uri::decode(this->user_info()) != uri::decode(other.user_info()))
    {
        return false;
    }
    else if (uri::decode(this->host()) != uri::decode(other.host()))
    {
        // host is canonicalized to lowercase
        return false;
    }
    else if (this->port() != other.port())
    {
        return false;
    }
    else if (uri::decode(this->path()) != uri::decode(other.path()))
    {
        return false;
    }
    else if (uri::decode(this->query()) != uri::decode(other.query()))
    {
        return false;
    }
    else if (uri::decode(this->fragment()) != uri::decode(other.fragment()))
    {
        return false;
    }

    return true;
}
コード例 #3
0
ファイル: uri_test.cpp プロジェクト: b-xiang/pficommon
  EXPECT_TRUE(equal_percent_encoded_string(pfi_expected, pfi_actual));
}

TEST(uri, class)
{
  using pfi::network::uri;

  uri pfi("http://preferred.jp/product/sedue/");
  EXPECT_EQ("http", pfi.scheme());
  EXPECT_EQ("preferred.jp", pfi.authority());
  EXPECT_TRUE(pfi.userinfo().empty());
  EXPECT_EQ("preferred.jp", pfi.host());
  EXPECT_TRUE(pfi.port().empty());
  EXPECT_EQ("/product/sedue/", pfi.path());
  EXPECT_TRUE(pfi.query().empty());
  EXPECT_TRUE(pfi.fragment().empty());

  uri complex("http://*****:*****@a.com:80/aoeu/htns?q=1234&r=5678#n42");
  EXPECT_EQ("http", complex.scheme());
  EXPECT_EQ("user:[email protected]:80", complex.authority());
  EXPECT_EQ("user:pass", complex.userinfo());
  EXPECT_EQ("a.com", complex.host());
  EXPECT_EQ("80", complex.port());
  EXPECT_EQ("/aoeu/htns", complex.path());
  EXPECT_EQ("q=1234&r=5678", complex.query());
  EXPECT_EQ("n42", complex.fragment());

  uri ipv6("http://[2001:0DB8:0000:CD30:0123:4567:89AB:CDEF]/");
  EXPECT_EQ("http", ipv6.scheme());
  EXPECT_EQ("[2001:0DB8:0000:CD30:0123:4567:89AB:CDEF]", ipv6.host());
}
コード例 #4
0
ファイル: uri.hpp プロジェクト: AmaiSaeta/cpp-netlib
inline
std::string fragment(const uri &uri_) {
    return uri_.fragment();
}