Skip to content

Commit

Permalink
Support for Presigned URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
giuspen committed Oct 1, 2023
1 parent 0d37504 commit 4be42de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions source/include/sigv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@
*/
#define SIGV4_HTTP_PAYLOAD_IS_HASH 0x8U

/**
* @ingroup sigv4_canonical_flags
* @brief Set this flag to indicate that the HTTP request payload is
* already hashed.
*
* This flag is valid only for #SigV4HttpParameters_t.flags.
*/
#define SIGV4_HTTP_PAYLOAD_IS_UNSIGNED 0x10U

/**
* @ingroup sigv4_canonical_flags
* @brief Set this flag to indicate that the HTTP request path, query, and
Expand Down
9 changes: 8 additions & 1 deletion source/sigv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -2083,7 +2083,7 @@ static void generateCredentialScope( const SigV4Parameters_t * pSigV4Params,
pBufCur + 1U,
&valueBytesWritten,
true,
true );
false );

if( returnStatus == SigV4Success )
{
Expand Down Expand Up @@ -3090,6 +3090,13 @@ static SigV4Status_t writePayloadHashToCanonicalRequest( const SigV4Parameters_t
/* Remove new line at the end of the payload. */
pCanonicalContext->pBufCur--;
}
else if( FLAG_IS_SET( pParams->pHttpParameters->flags, SIGV4_HTTP_PAYLOAD_IS_UNSIGNED ) )
{
/* Copy the UNSIGNED-PAYLOAD data in the headers data list. */
returnStatus = copyHeaderStringToCanonicalBuffer( "UNSIGNED-PAYLOAD", strlen("UNSIGNED-PAYLOAD"), pParams->pHttpParameters->flags, '\n', pCanonicalContext );
/* Remove new line at the end of the payload. */
pCanonicalContext->pBufCur--;
}
else
{
encodedLen = pCanonicalContext->bufRemaining;
Expand Down

0 comments on commit 4be42de

Please sign in to comment.