mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
Update PocoHTTPClient.cpp
This commit is contained in:
parent
524113f497
commit
5685738d08
@ -176,10 +176,30 @@ void PocoHTTPClient::makeRequestInternal(
|
||||
|
||||
Poco::Net::HTTPRequest poco_request(Poco::Net::HTTPRequest::HTTP_1_1);
|
||||
|
||||
/// N.B. Aws::Http::URI will encode uri in appropriate way for AWS S3 server.
|
||||
/// Poco::URI does that in incompatible way which can lead to double decoding.
|
||||
/// For example, `+` symbol will not be converted to `%2B` by Poco and would
|
||||
/// be received as space symbol.
|
||||
/** Aws::Http::URI will encode uri in appropriate way for AWS S3 server.
|
||||
* Poco::URI does that in incompatible way which can lead to double decoding.
|
||||
* For example, `+` symbol will not be converted to `%2B` by Poco and would
|
||||
* be received as space symbol.
|
||||
*
|
||||
* References:
|
||||
* https://github.com/aws/aws-sdk-java/issues/1946
|
||||
* https://forums.aws.amazon.com/thread.jspa?threadID=55746
|
||||
*
|
||||
* Example:
|
||||
* Suppose we are requesting a file: abc+def.txt
|
||||
* To correctly do it, we need to construct an URL containing either:
|
||||
* - abc%2Bdef.txt
|
||||
* this is also technically correct:
|
||||
* - abc+def.txt
|
||||
* but AWS servers don't support it properly, interpreting plus character as whitespace
|
||||
* although it is in path part, not in query string.
|
||||
* e.g. this is not correct:
|
||||
* - abc%20def.txt
|
||||
*
|
||||
* Poco will keep plus character as is (which is correct) while AWS servers will treat it as whitespace, which is not what is intended.
|
||||
* To overcome this limitation, we encode URL with "Aws::Http::URI" and then pass already prepared URL to Poco.
|
||||
*/
|
||||
|
||||
Aws::Http::URI aws_target_uri(uri);
|
||||
poco_request.setURI(aws_target_uri.GetPath() + aws_target_uri.GetQueryString());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user