-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test to skip the Content-Length in ApacheHttpRequestFactory should be case insensitive #2503
Comments
@outsideMyBox can you tell us more about your use case? How is the |
Hi @debora-ito , |
Understood. We don't guarantee that SDK operations will work with third party S3 providers, we need to guarantee that it is working with S3 directly, which it is. But I'll bring this up to the team, and will change to a feature request. |
Quick update: we've added this task to the our backlog. |
@outsideMyBox have you tried using Java SDK 2.x? It changed the way it handles request headers and you can plug in different http clients. Although this was added to the backlog, the team focus is in releasing features for 2.x and this would have a very low priority. |
@debora-ito Thanks for the hint. Unfortunately, switching to the SDK 2.0 would involve too much refactoring on our side relative to the time we can spend at the moment. |
@outsideMyBox run into a similar issue when testing. AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard();
builder.withRequestHandlers(new RequestHandler2() {
public void beforeRequest(Request<?> request) {
Map<String, String> headers = request.getHeaders();
if (!StringUtils.isAllLowerCase(HttpHeaders.CONTENT_LENGTH) && headers.containsKey(HttpHeaders.CONTENT_LENGTH)) {
headers.remove(HttpHeaders.CONTENT_LENGTH.toLowerCase());
}
super.beforeRequest(request);
}
}); |
Hi, @mosche
Error:
Seems It could upload the temporary files (something like s3://jin/.temp-beam), but couldn't move it to s3://jin/apiIdResponse.csv And, after adding builder.withRequestHandlers, it got another error complaining that it want a Content-Length in http header.
Related libraries:
Do you have anything idea about how to fix it? |
I added a condition and it works! Remove the "content-length" only when it equals "0"
|
@outsideMyBox We don't have plans to support this in v1 before going into Maintenance Mode, so I'll go ahead and close this issue. The workaround is to use RequestHandlers to change the header, like the examples in this thread show. If this issue is still relevant in v2 please open a new issue in the v2 repo. Reference:
|
This issue is now closed. Comments on closed issues are hard for our team to see. |
There is a test in ApacheHttpRequestFactory to skip the Content-Length and avoid the HttpClient4 to complain if it's already present.
The problem is that the test is case sensitive whereas headers are not according to the rfc2616 standard.
For example the header 'content-length' is not skipped
Describe the bug
The test should be case insensitive.
Expected Behavior
Skip any header in the list independently of their case.
Current Behavior
A request with 'content-length' leads to an exception:
Your Environment
The text was updated successfully, but these errors were encountered: