Skip to content

Commit

Permalink
switch url encode (#2910)
Browse files Browse the repository at this point in the history
* switch url encode for s3 crt calls

* bump crt + test update
  • Loading branch information
DmitriyMusatkin committed Apr 4, 2024
1 parent 5fca972 commit 3abf409
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/aws-cpp-sdk-core/source/http/HttpRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,16 @@ namespace Aws
port << ":" << uri.GetPort();
}

// Note: GetURLEncodedPathRFC3986 does legacy mode by default, which
// leaves some reserved delimeter characters unencoded (things like
// = or , in RFC 3986 parlance). This mode can be adjusted using
// flag to use a modern GetURLEncodedPath encoding approach (i.e.
// encode everything except for a couple of known safe chars). In
// practice however CRT will never support legacy mode and will
// always need modern encoding, so be explicit here about which mode
// we use.
ss << SchemeMapper::ToString(uri.GetScheme()) << SEPARATOR << uri.GetAuthority() << port.str()
<< ((uri.GetPath() == "/") ? "" : uri.GetURLEncodedPathRFC3986())
<< ((uri.GetPath() == "/") ? "" : uri.GetURLEncodedPath())
<< uri.GetQueryString();

request->SetPath(Aws::Crt::ByteCursorFromCString(ss.str().c_str()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace
//windows won't let you hard code unicode strings in a source file and assign them to a char*. Every other compiler does and I need to test this.
//to get around this, this string is url encoded version of "TestUnicode中国Key". At test time, we'll convert it to the unicode string
static const char* URLENCODED_UNICODE_KEY = "TestUnicode%E4%B8%AD%E5%9B%BDKey";
static const char* URIESCAPE_KEY = "Esc ape+Me$";
static const char* URIESCAPE_KEY = "Esc a=pe+Me$";
static const char* TEST_BUCKET_TAG = "IntegrationTestResource";

static const int TIMEOUT_MAX = 20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace
//windows won't let you hard code unicode strings in a source file and assign them to a char*. Every other compiler does and I need to test this.
//to get around this, this string is url encoded version of "TestUnicode中国Key". At test time, we'll convert it to the unicode string
static const char* URLENCODED_UNICODE_KEY = "TestUnicode%E4%B8%AD%E5%9B%BDKey";
static const char* URIESCAPE_KEY = "Esc ape+Me$";
static const char* URIESCAPE_KEY = "Esc a=pe+Me$";
static const char* CUSTOM_ENDPOINT_OVERRIDE = "beta.example.com";
static const char* TEST_BUCKET_TAG = "IntegrationTestResource";

Expand Down

0 comments on commit 3abf409

Please sign in to comment.