8#include <aws/core/Core_EXPORTS.h>
10#include <aws/core/http/Scheme.h>
11#include <aws/core/utils/memory/stl/AWSMap.h>
12#include <aws/core/utils/StringUtils.h>
20 extern AWS_CORE_API
const char*
SEPARATOR;
37 class AWS_CORE_API
URI
54 URI& operator = (
const char*);
56 bool operator == (
const URI&)
const;
58 bool operator == (
const char*)
const;
59 bool operator != (
const URI&)
const;
61 bool operator != (
const char*)
const;
86 inline uint16_t
GetPort()
const {
return m_port; }
92 inline void SetPort(uint16_t value) { m_port = value; }
126 segment.erase(0, segment.find_first_not_of(
'/'));
127 segment.erase(segment.find_last_not_of(
'/') + 1);
128 m_pathSegments.push_back(segment);
129 m_pathHasTrailingSlash =
false;
142 ? Utils::StringUtils::SplitOptions::INCLUDE_EMPTY_SEGMENTS
143 : Utils::StringUtils::SplitOptions::NOT_SET;
147 if (
s_preservePathSeparators && m_pathSegments.empty() && !split.empty() && split.front().empty() && !m_pathHasTrailingSlash) {
148 split.erase(split.begin());
150 for (
const auto& segment: split)
152 m_pathSegments.push_back(segment);
154 m_pathHasTrailingSlash = (!segments.empty() && segments.back() ==
'/');
219 void ExtractAndSetAuthority(
const Aws::String& uri);
222 void ExtractAndSetQueryString(
const Aws::String& uri);
223 bool CompareURIParts(
const URI& other)
const;
225 Scheme m_scheme = Scheme::HTTP;
229 bool m_pathHasTrailingSlash =
false;
230 bool m_useRfcEncoding =
false;
void CanonicalizeQueryString()
void SetRfc3986Encoded(const bool value)
void SetScheme(Scheme value)
static Aws::String URLEncodePathRFC3986(const Aws::String &path, bool rfcCompliantEncoding=false)
Aws::String GetFormParameters() const
void AddQueryStringParameter(const char *key, const Aws::String &value)
void AddQueryStringParameter(const Aws::Map< Aws::String, Aws::String > &queryStringPairs)
void SetPath(const Aws::String &value)
void AddPathSegments(T pathSegments)
static Aws::String URLEncodePath(const Aws::String &path)
Aws::String GetURIString(bool includeQueryString=true) const
const Aws::String & GetAuthority() const
const Aws::String & GetQueryString() const
Aws::String GetURLEncodedPath() const
QueryStringParameterCollection GetQueryStringParameters(bool decode=true) const
Aws::String GetURLEncodedPathRFC3986() const
void SetAuthority(const Aws::String &value)
void AddPathSegment(T pathSegment)
bool IsRfc3986Encoded() const
void SetQueryString(const Aws::String &str)
void SetPort(uint16_t value)
Aws::String GetPath() const
static Aws::Vector< Aws::String > Split(const Aws::String &toSplit, char splitOn)
Splits a string on a delimiter (empty items are excluded).
AWS_CORE_API void SetPreservePathSeparators(bool preservePathSeparators)
Aws::MultiMap< Aws::String, Aws::String > QueryStringParameterCollection
bool s_compliantRfc3986Encoding
AWS_CORE_API bool s_preservePathSeparators
static const uint16_t HTTPS_DEFAULT_PORT
static const uint16_t HTTP_DEFAULT_PORT
AWS_CORE_API const char * SEPARATOR
AWS_CORE_API void SetCompliantRfc3986Encoding(bool compliant)
std::basic_stringstream< char, std::char_traits< char >, Aws::Allocator< char > > StringStream
std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > Map
std::multimap< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > MultiMap
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
std::vector< T, Aws::Allocator< T > > Vector