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

wsgi proxy and 'hop by hop' #133

Open
faassen opened this issue Aug 7, 2014 · 3 comments
Open

wsgi proxy and 'hop by hop' #133

faassen opened this issue Aug 7, 2014 · 3 comments

Comments

@faassen
Copy link
Contributor

faassen commented Aug 7, 2014

The WSGI proxy implementation passes hop-by-hop related headers (like transfer-encoding, connection, etc) through unchanged. According to PEP 3333 these however do not apply to WSGI:

http://legacy.python.org/dev/peps/pep-3333/

Indeed Waitress gives an exception when you try, and mod_wsgi seems to choke on such requests.

Since the WSGI proxy should be a conformant WSGI implementation, it should remove these hop by hop headers. This won't affect chunking, as if the proxy is proxying a chunked response, WSGI will return the chunks one by one in its iterator result. A WSGI server can then add them back again (I've seen Waitress does).

@faassen
Copy link
Contributor Author

faassen commented Aug 11, 2014

The newest HTTP 1.1 rfc versions don't seem to define hop by hop anymore. They used to be in see RFC 2616, section 13.5.1. RFC 7230 section 6.1 does say that a proxy must remove Connection as well as anything listed in the connection header (unless that's close, I guess).

@faassen
Copy link
Contributor Author

faassen commented Aug 19, 2014

I've investigated this some more, and here are my conclusions:

http://blog.startifact.com/posts/new-http-rfcs-versus-wsgi.html

Until the WSGI pep is updated I think we should just hardcode the list anyway. We know for sure that not removing these headers won't be compatible with a WSGI server. In fact, Waitress just complains when you try to send out Transfer-Encoding to it from a WSGI app.

@faassen
Copy link
Contributor Author

faassen commented Dec 1, 2014

Now I wonder whether my analysis was correct. Waitress should be able to handle a hop-by-hop header as it's a HTTP server. I think it complains when the underlying WSGI code tries to generate a hop-by-hop header, which is odd because I didn't think we were...

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

No branches or pull requests

1 participant