Skip to content
Permalink
Browse files

Add missing httpUriEncode() in S3 request.

This was not a live bug since the files currently handled by C can't have special characters in them.
  • Loading branch information...
dwsteele committed Apr 29, 2019
1 parent 62b48d8 commit c935b1c9e83d6f14644de3aa5f36011234e69423
Showing with 7 additions and 3 deletions.
  1. +4 −0 doc/xml/release.xml
  2. +1 −1 src/storage/driver/s3/storage.c
  3. +2 −2 test/src/module/storage/s3Test.c
@@ -49,6 +49,10 @@
<p>Add macros to create constant <code>Buffer</code> objects.</p>
</release-item>

<release-item>
<p>Add missing <code>httpUriEncode()</code> in S3 request.</p>
</release-item>

<release-item>
<p>Add <code>unsigned int</code> <code>Variant</code> type and update code to use it.</p>
</release-item>
@@ -336,7 +336,7 @@ storageDriverS3Request(

// Generate authorization header
storageDriverS3Auth(
this, verb, uri, query, storageDriverS3DateTime(time(NULL)), requestHeader,
this, verb, httpUriEncode(uri, true), query, storageDriverS3DateTime(time(NULL)), requestHeader,
body == NULL || bufUsed(body) == 0 ?
STRDEF("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") :
bufHex(cryptoHashOne(HASH_TYPE_SHA256_STR, body)));
@@ -89,7 +89,7 @@ testS3Server(void)
// storageDriverS3NewRead() and StorageDriverS3FileRead
// -------------------------------------------------------------------------------------------------------------------------
// Ignore missing file
harnessTlsServerExpect(testS3ServerRequest(HTTP_VERB_GET, "/file.txt", NULL));
harnessTlsServerExpect(testS3ServerRequest(HTTP_VERB_GET, "/fi%26le.txt", NULL));
harnessTlsServerReply(testS3ServerResponse(404, "Not Found", NULL, NULL));

// Error on missing file
@@ -543,7 +543,7 @@ testRun(void)
// storageDriverS3NewRead() and StorageDriverS3FileRead
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_PTR(
storageGetNP(storageNewReadP(s3, strNew("file.txt"), .ignoreMissing = true)), NULL, "ignore missing file");
storageGetNP(storageNewReadP(s3, strNew("fi&le.txt"), .ignoreMissing = true)), NULL, "ignore missing file");
TEST_ERROR(
storageGetNP(storageNewReadNP(s3, strNew("file.txt"))), FileMissingError,
"unable to open '/file.txt': No such file or directory");

0 comments on commit c935b1c

Please sign in to comment.
You can’t perform that action at this time.