File tree Expand file tree Collapse file tree 8 files changed +328
-290
lines changed
Expand file tree Collapse file tree 8 files changed +328
-290
lines changed Original file line number Diff line number Diff line change 11import type { ArsenalRequestHeaders } from '../../types/ArsenalRequest' ;
2+ import { normalizeHeaderValue } from '../../utils/normalizeHeaders' ;
23
34export default function getCanonicalizedAmzHeaders ( headers : ArsenalRequestHeaders , clientType : string ) {
45 /*
@@ -16,9 +17,7 @@ export default function getCanonicalizedAmzHeaders(headers: ArsenalRequestHeader
1617 // AWS SDK v3 can pass header values as arrays (for multiple values),
1718 // strings, or other types. We need to normalize them before calling .trim()
1819 // Per HTTP spec and AWS Signature v2, multiple values are joined with commas
19- const stringValue = Array . isArray ( headerValue )
20- ? headerValue . join ( ',' )
21- : String ( headerValue ) ;
20+ const stringValue = normalizeHeaderValue ( headerValue ) ;
2221 return [ val . trim ( ) , stringValue . trim ( ) ] ;
2322 } ) ;
2423 /*
Original file line number Diff line number Diff line change 11import * as crypto from 'crypto' ;
22import * as queryString from 'querystring' ;
33import awsURIencode from './awsURIencode' ;
4+ import { normalizeHeaderValue } from '../../utils/normalizeHeaders' ;
45
56/**
67 * createCanonicalRequest - creates V4 canonical request
@@ -77,9 +78,7 @@ export default function createCanonicalRequest(
7778 // AWS SDK v3 can pass header values as arrays (for multiple values),
7879 // strings, or other types. We need to normalize them before calling .trim()
7980 // Per HTTP spec and AWS Signature v4, multiple values are joined with commas
80- const stringValue = Array . isArray ( headerValue )
81- ? headerValue . join ( ',' )
82- : String ( headerValue ) ;
81+ const stringValue = normalizeHeaderValue ( headerValue ) ;
8382 const trimmedHeader = stringValue
8483 . trim ( ) . replace ( / \s + / g, ' ' ) ;
8584 return `${ signedHeader } :${ trimmedHeader } \n` ;
Original file line number Diff line number Diff line change @@ -294,8 +294,22 @@ export default class Client implements KMSInterface {
294294 * additional permissions). Callers should rely on higher-level health
295295 * checks provided by their services instead of this method.
296296 */
297+ /*
297298 healthcheck(logger: werelogs.Logger, cb: (err: Error | null) => void): void {
298- logger . debug ( "AWS KMS: healthcheck is a no-op (disabled)" ) ;
299- cb ( null ) ;
299+ logger.debug("AWS KMS: performing healthcheck");
300+
301+ const command = new ListKeysCommand({
302+ Limit: 1,
303+ });
304+
305+ this.client.send(command).then(() => {
306+ logger.debug("AWS KMS healthcheck: list keys succeeded");
307+ cb(null);
308+ }).catch(err => {
309+ const error = arsenalErrorAWSKMS(err);
310+ logger.error("AWS KMS healthcheck: failed to list keys", { err });
311+ cb(error);
312+ });
300313 }
314+ */
301315}
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ const { S3Client,
1616 GetBucketVersioningCommand,
1717 NoSuchKey,
1818 NotFound } = require ( '@aws-sdk/client-s3' ) ;
19- const { HttpRequest } = require ( '@smithy/protocol-http' ) ;
2019const { Upload } = require ( '@aws-sdk/lib-storage' ) ;
2120const werelogs = require ( 'werelogs' ) ;
2221const { Readable } = require ( 'stream' ) ;
@@ -52,14 +51,7 @@ class AwsClient {
5251
5352 setup ( cb ) {
5453 const callback = typeof cb === 'function' ? cb : ( ) => { } ;
55- let settled = false ;
56- const done = err => {
57- if ( settled ) {
58- return ;
59- }
60- settled = true ;
61- callback ( err ) ;
62- } ;
54+ const done = jsutil . once ( callback ) ;
6355 let usEast1Client ;
6456 try {
6557 usEast1Client = new S3Client ( {
Original file line number Diff line number Diff line change @@ -198,8 +198,7 @@ class MpuHelper {
198198 return next ( ) ;
199199 } ) ;
200200 } , err => callback ( err ) ) ;
201- } ;
202-
201+ } ;
203202 return async . waterfall ( [
204203 _getObjectVersions ,
205204 _deleteObjects ,
You can’t perform that action at this time.
0 commit comments