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

PUT object response should include "ETag" instead of "Etag" #3284

Closed
shaon opened this Issue Nov 18, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@shaon

shaon commented Nov 18, 2016

For PUT object requests, Minio response header includes "Etag", instead of "ETag". Apparently this compatibility mismatch breaks AWS SDK 1.7.1 and PUT object requests fails. However, it seem to work with AWS Java SDK 1.10.x.

Expected Behavior

AWS responses for PUT object:

[main] DEBUG -  Receiving response: HTTP/1.1 200 OK
[main] DEBUG -  << HTTP/1.1 200 OK
[main] DEBUG -  << Accept-Ranges: bytes
[main] DEBUG -  << Etag: "72f2c1c9e0d923e3c5e8db9c0ea692e6"
[main] DEBUG -  << Server: Minio/RELEASE.2016-10-24T21-23-47Z (linux; amd64)
[main] DEBUG -  << Vary: Origin
[main] DEBUG -  << X-Amz-Request-Id: EL1SEGSAFP6E2104
[main] DEBUG -  << Date: Thu, 17 Nov 2016 23:39:38 GMT
[main] DEBUG -  << Content-Length: 0
[main] DEBUG -  << Content-Type: text/plain; charset=utf-8

Also, according to the AWS Documentation it's "ETag",
http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html

Current Behavior

Minio returns:

[main] DEBUG -  Receiving response: HTTP/1.1 200 OK
[main] DEBUG -  << HTTP/1.1 200 OK
[main] DEBUG -  << Accept-Ranges: bytes
[main] DEBUG -  << Etag: "72f2c1c9e0d923e3c5e8db9c0ea692e6"
[main] DEBUG -  << Server: Minio/RELEASE.2016-10-24T21-23-47Z (linux; amd64)
[main] DEBUG -  << Vary: Origin
[main] DEBUG -  << X-Amz-Request-Id: X09WUBSOKN2UII1C
[main] DEBUG -  << Date: Fri, 18 Nov 2016 18:30:13 GMT
[main] DEBUG -  << Content-Length: 0
[main] DEBUG -  << Content-Type: text/plain; charset=utf-8
[main] DEBUG -  Connection can be kept alive indefinitely
[main] DEBUG -  Received successful response: 200, AWS Request ID: null
[main] DEBUG -  Connection [id: 0][route: {}->http://10.116.159.114:9000] can be kept alive indefinitely
[main] DEBUG -  Connection released: [id: 0][route: {}->http://10.116.159.114:9000][total kept alive: 1; route allocated: 1 of 50; total allocated: 1 of 50]
Exception in thread "main" java.lang.NullPointerException
	at com.amazonaws.util.BinaryUtils.fromHex(BinaryUtils.java:72)
	at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1380)
	at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1210)
	at com.Test1.checkPutGet(Test1.java:57)
	at com.Test1.main(Test1.java:67)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Possible Solution

Replace Etag to ETag in response header.

Steps to Reproduce (for bugs)

Any PUT object requests with AWS Java SDK 1.7.1 should reproduce this issue.

Context

Found this issue while using Minio with another system that uses AWS Java SDK 1.7.1.

Environment

  • Version used:
$ ./minio version
Version: 2016-10-24T21:23:47Z
Release-Tag: RELEASE.2016-10-24T21-23-47Z
Commit-ID: 048af5e5cdc1344e83231c09079828a3d289e6df

AWS Java SDK 1.7.1
@harshavardhana

This comment has been minimized.

Show comment
Hide comment
@harshavardhana

harshavardhana Nov 18, 2016

Member

HTTP response headers are case insensitive ETag, Etag, eTag all are allowed,

http://www.ietf.org/rfc/rfc2616.txt

4.2 Message Headers

   HTTP header fields, which include general-header (section 4.5),
   request-header (section 5.3), response-header (section 6.2), and
   entity-header (section 7.1) fields, follow the same generic format as
   that given in Section 3.1 of RFC 822 [9]. Each header field consists
   of a name followed by a colon (":") and the field value. Field names
   are case-insensitive. The field value MAY be preceded by any amount
   of LWS, though a single SP is preferred. Header fields can be
   extended over multiple lines by preceding each extra line with at
   least one SP or HT. Applications ought to follow "common form", where
   one is known or indicated, when generating HTTP constructs, since
   there might exist some implementations that fail to accept anything

AWS Java SDK is buggy which needs to fix this bug.

Member

harshavardhana commented Nov 18, 2016

HTTP response headers are case insensitive ETag, Etag, eTag all are allowed,

http://www.ietf.org/rfc/rfc2616.txt

4.2 Message Headers

   HTTP header fields, which include general-header (section 4.5),
   request-header (section 5.3), response-header (section 6.2), and
   entity-header (section 7.1) fields, follow the same generic format as
   that given in Section 3.1 of RFC 822 [9]. Each header field consists
   of a name followed by a colon (":") and the field value. Field names
   are case-insensitive. The field value MAY be preceded by any amount
   of LWS, though a single SP is preferred. Header fields can be
   extended over multiple lines by preceding each extra line with at
   least one SP or HT. Applications ought to follow "common form", where
   one is known or indicated, when generating HTTP constructs, since
   there might exist some implementations that fail to accept anything

AWS Java SDK is buggy which needs to fix this bug.

@harshavardhana

This comment has been minimized.

Show comment
Hide comment
@harshavardhana

harshavardhana Nov 18, 2016

Member

Here is the fix for AWS Java SDK - aws/aws-sdk-java#590

Member

harshavardhana commented Nov 18, 2016

Here is the fix for AWS Java SDK - aws/aws-sdk-java#590

@shaon

This comment has been minimized.

Show comment
Hide comment
@shaon

shaon Nov 18, 2016

Makes sense, thanks @harshavardhana!

shaon commented Nov 18, 2016

Makes sense, thanks @harshavardhana!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment