private void addHostHeader(SdkHttpFullRequest.Builder mutableRequest) { // AWS4 requires that we sign the Host header so we // have to have it in the request by the time we sign. StringBuilder hostHeaderBuilder = new StringBuilder(mutableRequest.host()); if (!SdkHttpUtils.isUsingStandardPort(mutableRequest.protocol(), mutableRequest.port())) { hostHeaderBuilder.append(":").append(mutableRequest.port()); } mutableRequest.putHeader(SignerConstant.HOST, hostHeaderBuilder.toString()); }
private void addHostHeader(SdkHttpFullRequest.Builder mutableRequest) { // AWS4 requires that we sign the Host header so we // have to have it in the request by the time we sign. StringBuilder hostHeaderBuilder = new StringBuilder(mutableRequest.host()); if (!SdkHttpUtils.isUsingStandardPort(mutableRequest.protocol(), mutableRequest.port())) { hostHeaderBuilder.append(":").append(mutableRequest.port()); } mutableRequest.putHeader(SignerConstant.HOST, hostHeaderBuilder.toString()); }
/** * Convenience method to set the {@link #protocol()}, {@link #host()}, {@link #port()}, and * {@link #encodedPath()} from a {@link URI} object. * * @param uri URI containing protocol, host, port and path. * @return This builder for method chaining. */ @Override default Builder uri(URI uri) { return this.protocol(uri.getScheme()) .host(uri.getHost()) .port(uri.getPort()) .encodedPath(SdkHttpUtils.appendUri(uri.getRawPath(), encodedPath())); }
/** * Convenience method to set the {@link #protocol()}, {@link #host()}, {@link #port()}, and * {@link #encodedPath()} from a {@link URI} object. * * @param uri URI containing protocol, host, port and path. * @return This builder for method chaining. */ @Override default Builder uri(URI uri) { return this.protocol(uri.getScheme()) .host(uri.getHost()) .port(uri.getPort()) .encodedPath(SdkHttpUtils.appendUri(uri.getRawPath(), encodedPath())); }
/** * @return True if payload signing is explicitly enabled. */ private boolean isPayloadSigningEnabled(SdkHttpFullRequest.Builder request, AwsS3V4SignerParams signerParams) { /** * If we aren't using https we should always sign the payload unless there is no payload */ if (!request.protocol().equals("https") && request.contentStreamProvider() != null) { return true; } Boolean isPayloadSigningEnabled = signerParams.enablePayloadSigning(); return isPayloadSigningEnabled != null && isPayloadSigningEnabled; }
/** * @return True if payload signing is explicitly enabled. */ private boolean isPayloadSigningEnabled(SdkHttpFullRequest.Builder request, AwsS3V4SignerParams signerParams) { /** * If we aren't using https we should always sign the payload unless there is no payload */ if (!request.protocol().equals("https") && request.contentStreamProvider() != null) { return true; } Boolean isPayloadSigningEnabled = signerParams.enablePayloadSigning(); return isPayloadSigningEnabled != null && isPayloadSigningEnabled; }
@Override protected String calculateContentHash(SdkHttpFullRequest.Builder mutableRequest, Aws4SignerParams signerParams) { if ("https".equals(mutableRequest.protocol())) { return "UNSIGNED-PAYLOAD"; } return super.calculateContentHash(mutableRequest, signerParams); }
@Override protected String calculateContentHash(SdkHttpFullRequest.Builder mutableRequest, Aws4SignerParams signerParams) { if ("https".equals(mutableRequest.protocol())) { return "UNSIGNED-PAYLOAD"; } return super.calculateContentHash(mutableRequest, signerParams); }