Provides URL encoding functionality. More...
#include <url.hpp>
Static Public Member Functions | |
| static std::string | encode_path (std::string_view path, std::string_view chars_to_encode=std::string_view{ aws_special_chars, sizeof(aws_special_chars)}) |
| Percent-encodes specified characters in a URL path. More... | |
Static Public Attributes | |
| static constexpr char | aws_special_chars [] |
| Default set of special characters requiring encoding in AWS URLs. More... | |
Provides URL encoding functionality.
The AWS object naming documentation (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html) lists several types of special characters. In practice, handling them using libcurl is complex and described below.
aws_special_chars, because for private bucket they cause AWS authentication by libcurl to failaws_special_chars, because it can be legally used as a path separator. For the space character and ?, although KvikIO has them in aws_special_chars, users must manually percent encode them to %20 and %3F, respectively. Otherwise, the space character will be considered malformed by libcurl, and ? cause ambiguity with the query string. For the control characters, KvikIO include them all in aws_special_chars.aws_special_chars.
|
static |
Percent-encodes specified characters in a URL path.
Performs percent-encoding (RFC 3986) on a given path string, encoding only the characters specified in the chars_to_encode parameter. Each encoded character is replaced with its percent-encoded equivalent (XX where XX is the hexadecimal representation of the character).
Only ASCII characters (0-127) are supported for encoding. Non-ASCII characters in chars_to_encode will be encoded to an empty string. Characters not in chars_to_encode are passed through unchanged.
| path | The path string to encode |
| chars_to_encode | Set of characters that should be encoded (defaults to aws_special_chars) |
|
staticconstexpr |
Default set of special characters requiring encoding in AWS URLs.