protected String getCanonicalizedEndpoint(SdkHttpFullRequest request) { String endpointForStringToSign = StringUtils.lowerCase(request.host()); // Omit the port from the endpoint if we're using the default port for the protocol. Some HTTP clients (ie. Apache) don't // allow you to specify it in the request, so we're standardizing around not including it. See SdkHttpRequest#port(). if (!SdkHttpUtils.isUsingStandardPort(request.protocol(), request.port())) { endpointForStringToSign += ":" + request.port(); } return endpointForStringToSign; }
protected String getCanonicalizedEndpoint(SdkHttpFullRequest request) { String endpointForStringToSign = StringUtils.lowerCase(request.host()); // Omit the port from the endpoint if we're using the default port for the protocol. Some HTTP clients (ie. Apache) don't // allow you to specify it in the request, so we're standardizing around not including it. See SdkHttpRequest#port(). if (!SdkHttpUtils.isUsingStandardPort(request.protocol(), request.port())) { endpointForStringToSign += ":" + request.port(); } return endpointForStringToSign; }
/** * Modifies the given {@link SdkHttpFullRequest} with new host if host prefix is enabled and set. */ private static SdkHttpFullRequest modifyEndpointHostIfNeeded(SdkHttpFullRequest originalRequest, SdkClientConfiguration clientConfiguration, ClientExecutionParams executionParams) { if (executionParams.discoveredEndpoint() != null) { URI discoveredEndpoint = executionParams.discoveredEndpoint(); return originalRequest.toBuilder().host(discoveredEndpoint.getHost()).port(discoveredEndpoint.getPort()).build(); } Boolean disableHostPrefixInjection = clientConfiguration.option(SdkAdvancedClientOption.DISABLE_HOST_PREFIX_INJECTION); if ((disableHostPrefixInjection != null && disableHostPrefixInjection.equals(Boolean.TRUE)) || StringUtils.isEmpty(executionParams.hostPrefixExpression())) { return originalRequest; } return originalRequest.toBuilder() .host(executionParams.hostPrefixExpression() + originalRequest.host()) .build(); }