Skip to content
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

Converting HTTP header name to lower case #80

Closed
asramakanth opened this issue Mar 19, 2014 · 3 comments · May be fixed by #68
Closed

Converting HTTP header name to lower case #80

asramakanth opened this issue Mar 19, 2014 · 3 comments · May be fixed by #68

Comments

@asramakanth
Copy link

Eventlet is converting the standard HTTP header name 'ETag' to 'Etag' with a lower case. This breaks other libraries/projects that use Eventlet.

http://en.wikipedia.org/wiki/HTTP_ETag

This is caused from a problem of eventlet which is a WSGI library of python.
Eventlet always converts the key (name) of HTTP headers into the formats like as 'Etag' with the rules as follows:
Converting the first character of the key into a upper case letter
Converting the first characters leading to '-' into a upper case letters
Converting all other characters into lower case letters
i.e. currently, we have no way to prevent that eventlet converts "ETag" into "Etag".

Does anyone have good idea for solving it?

@temoto
Copy link
Member

temoto commented Mar 20, 2014

Hello, @asramakanth . Thank you for your message.

As per HTTP standard, header names are case-insensitive. That means, with Eventlet or any other software, you could receive any of "etag", "ETAG" or "eTAg" and they all MUST work the same way.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2

... 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 ...

Consider there may be other users who also ignore HTTP standard and expect current header name case, "Etag". Suppose we fix the issue in your favor, then it would break some other code.

Clean solution is to ignore header name case. Usually people do this by converting all header names to lower case ("etag") and searching for those strings.

@temoto temoto closed this as completed Mar 20, 2014
@temoto
Copy link
Member

temoto commented Mar 21, 2014

Upon receiving more input from Swift team, namely

Implementation of AWS S3 violates many HTTP specs (even violate S3 spec itself!!), and many S3 clients follow it. If what you want is to claim that your product is fully compatible with AWS S3, you should violate spec, and hacking current HTTP framework/library, too.

eventlet.wsgi.server should accept new option to disable header case normalization. Said option must be disabled by default and produce warning with explanation when enabled.

@temoto temoto reopened this Mar 21, 2014
@temoto temoto self-assigned this Mar 21, 2014
temoto added a commit that referenced this issue Mar 21, 2014
Setting this to False provides compatibility with broken clients
which expect response header names in particular case, such as
ETag by AWS Java SDK.
#80
temoto added a commit that referenced this issue Mar 28, 2014
Setting this to False provides compatibility with broken clients
which expect response header names in particular case, such as
ETag by AWS Java SDK.
#80
temoto added a commit that referenced this issue Apr 22, 2014
Setting this to False provides compatibility with broken clients
which expect response header names in particular case, such as
ETag by AWS Java SDK.
#80
@temoto
Copy link
Member

temoto commented Apr 22, 2014

Swift team has responded that the fix works for them. The fix is merged into master e4dedf7

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

Successfully merging a pull request may close this issue.

2 participants