@@ -435,22 +435,26 @@ func handleAWSRequest(req *http.Request, body []byte, respCode int) {
435
435
436
436
if hostSplit [len (hostSplit )- 1 ] == "com" && hostSplit [len (hostSplit )- 2 ] == "amazonaws" {
437
437
endpointPrefix := hostSplit [len (hostSplit )- 3 ] // "s3".amazonaws.com
438
- if len (hostSplit ) > 3 {
439
- endpointPrefix = hostSplit [len (hostSplit )- 4 ] // "s3".us-east-1.amazonaws.com
440
- }
441
- if len (hostSplit ) > 4 {
442
- if endpointPrefix == "dualstack" {
443
- endpointPrefix = hostSplit [len (hostSplit )- 5 ] // "s3".dualstack.us-east-1.amazonaws.com
444
- if len (hostSplit ) > 5 {
445
- endpointUriPrefix = strings .Join (hostSplit [:len (hostSplit )- 5 ], "." ) // "bucket.name".s3.dualstack.us-east-1.amazonaws.com
438
+ if endpointPrefix == "s3" && len (hostSplit ) > 3 {
439
+ endpointUriPrefix = strings .Join (hostSplit [:len (hostSplit )- 3 ], "." ) // "bucket.name".s3.amazonaws.com
440
+ } else {
441
+ if len (hostSplit ) > 3 {
442
+ endpointPrefix = hostSplit [len (hostSplit )- 4 ] // "s3".us-east-1.amazonaws.com
443
+ }
444
+ if len (hostSplit ) > 4 {
445
+ if endpointPrefix == "dualstack" {
446
+ endpointPrefix = hostSplit [len (hostSplit )- 5 ] // "s3".dualstack.us-east-1.amazonaws.com
447
+ if len (hostSplit ) > 5 {
448
+ endpointUriPrefix = strings .Join (hostSplit [:len (hostSplit )- 5 ], "." ) // "bucket.name".s3.dualstack.us-east-1.amazonaws.com
449
+ }
450
+ } else if endpointPrefix == "ecr" { // api.ecr.us-east-1.amazonaws.com
451
+ endpointPrefix = "api.ecr"
452
+ } else {
453
+ endpointUriPrefix = strings .Join (hostSplit [:len (hostSplit )- 4 ], "." ) // "bucket.name".s3.us-east-1.amazonaws.com
446
454
}
447
- } else if endpointPrefix == "ecr" { // api.ecr.us-east-1.amazonaws.com
448
- endpointPrefix = "api.ecr"
449
- } else {
450
- endpointUriPrefix = strings .Join (hostSplit [:len (hostSplit )- 4 ], "." ) // "bucket.name".s3.us-east-1.amazonaws.com
451
455
}
452
-
453
456
}
457
+
454
458
for _ , serviceDefinition := range serviceDefinitions {
455
459
if serviceDefinition .Metadata .EndpointPrefix == endpointPrefix { // TODO: Ensure latest version
456
460
serviceDef = serviceDefinition
@@ -855,7 +859,7 @@ func gcpProcessResource(req *http.Request, gcpResource GCPResourceDefinition, ba
855
859
856
860
for _ , gcpMethod := range gcpResource .Methods {
857
861
if req .Method == gcpMethod .HTTPMethod {
858
- pathtemplate := generateMethodTemplate (basePath + gcpMethod .FlatPath )
862
+ pathtemplate := generateMethodTemplate (basePath + gcpMethod .FlatPath )
859
863
860
864
r , err := regexp .Compile (pathtemplate )
861
865
if err == nil && r .MatchString (req .URL .Path ) {
0 commit comments