File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ STATUS signAwsRequestInfoQueryParam(PRequestInfo pRequestInfo)
235235 (UINT32 )((pRequestInfo -> pAwsCredentials -> expiration - pRequestInfo -> currentTime ) / HUNDREDS_OF_NANOS_IN_A_SECOND ));
236236 expirationInSeconds = MAX (MIN_AWS_SIGV4_CREDENTIALS_EXPIRATION_IN_SECONDS , expirationInSeconds );
237237
238- #if 0 // Get the required size for the signedURL
238+ #if USE_DYNAMIC_URL // Get the required size for the signedURL
239239 UINT32 signedUrlLen = 0 ;
240240 {
241241 UINT32 encodedReqLen = 0 ;
@@ -276,9 +276,6 @@ STATUS signAwsRequestInfoQueryParam(PRequestInfo pRequestInfo)
276276 strlen (SIGNATURE_PARAM_TEMPLATE ), NULL , & encodedReqLen ));
277277 signedUrlLen += encodedReqLen ;
278278 signedUrlLen += KVS_MAX_HMAC_SIZE ; // Hex signature value size;
279-
280- // + 200 lumpsum bytes to encode other extra requirements (&, =)
281- // signedUrlLen += 200;
282279 }
283280
284281 // Replace the URL with the larger buffer which could hold signed URL
Original file line number Diff line number Diff line change @@ -832,6 +832,8 @@ struct __RequestHeader {
832832};
833833typedef struct __RequestHeader * PRequestHeader ;
834834
835+ #define USE_DYNAMIC_URL 1
836+
835837/**
836838 * @brief Request info structure
837839 */
@@ -843,7 +845,11 @@ struct __RequestInfo {
843845 //!< NOTE: In streaming mode the body will be NULL
844846 //!< NOTE: The body will follow the main struct
845847 UINT32 bodySize ; //!< Size of the body in bytes
848+ #if USE_DYNAMIC_URL
849+ PCHAR url ; //!< The URL for the request
850+ #else
846851 CHAR url [MAX_URI_CHAR_LEN + 1 ]; //!< The URL for the request
852+ #endif
847853 CHAR certPath [MAX_PATH_LEN + 1 ]; //!< CA Certificate path to use - optional
848854 CHAR sslCertPath [MAX_PATH_LEN + 1 ]; //!< SSL Certificate file path to use - optional
849855 CHAR sslPrivateKeyPath [MAX_PATH_LEN + 1 ]; //!< SSL Certificate private key file path to use - optional
Original file line number Diff line number Diff line change @@ -112,16 +112,16 @@ PUBLIC_API STATUS createRequestInfo
112112 pRequestInfo -> currentTime = GETTIME ();
113113 pRequestInfo -> callAfter = pRequestInfo -> currentTime ;
114114 STRNCPY (pRequestInfo -> region , region , MAX_REGION_NAME_LEN );
115- #if 1
116- STRNCPY (pRequestInfo -> url , url , MAX_URI_CHAR_LEN );
117- #else
115+ #if USE_DYNAMIC_URL
118116 UINT32 urlLen = strlen (url );
119117 pRequestInfo -> url = MEMALLOC (urlLen + 1 );
120118 if (pRequestInfo -> url ) {
121119 // if allocation was not successful, user function of url will abort
122120 pRequestInfo -> url [urlLen ] = '\0' ;
123121 MEMCPY (pRequestInfo -> url , url , urlLen );
124122 }
123+ #else
124+ STRNCPY (pRequestInfo -> url , url , MAX_URI_CHAR_LEN );
125125#endif
126126 if (certPath != NULL ) {
127127 STRNCPY (pRequestInfo -> certPath , certPath , MAX_PATH_LEN );
@@ -189,8 +189,10 @@ PUBLIC_API STATUS freeRequestInfo(PRequestInfo* ppRequestInfo)
189189 // Free the header list itself
190190 singleListFree (pRequestInfo -> pRequestHeaders );
191191
192+ #if USE_DYNAMIC_URL
192193 // Release the url
193- // SAFE_MEMFREE(pRequestInfo->url);
194+ SAFE_MEMFREE (pRequestInfo -> url );
195+ #endif
194196
195197 // Release the object
196198 MEMFREE (pRequestInfo );
You can’t perform that action at this time.
0 commit comments