gunicorn icon indicating copy to clipboard operation
gunicorn copied to clipboard

Added support for proxy protocol v2.

Open apollo13 opened this issue 2 years ago • 4 comments

This PR adds support for proxy protocol v2 (v1 keeps working as well): https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt

Additionally I did rewrite the BytesIO usage to bytearray, the code becomes simpler imo because we can just keep a buffer around and resize it as needed.

apollo13 avatar Jan 02 '23 17:01 apollo13

Introduced by accident, will fix up later today.

On Fri, Jan 27, 2023, at 00:33, Benoit Chesneau wrote:

@.**** commented on this pull request.

In gunicorn/http/message.py https://github.com/benoitc/gunicorn/pull/2912#discussion_r1088442371:

from gunicorn.http.body import ChunkedReader, LengthReader, EOFReader, Body from gunicorn.http.errors import ( InvalidHeader, InvalidHeaderName, NoMoreData, InvalidRequestLine, InvalidRequestMethod, InvalidHTTPVersion, LimitRequestLine, LimitRequestHeaders, ) -from gunicorn.http.errors import InvalidProxyLine, ForbiddenProxyRequest -from gunicorn.http.errors import InvalidSchemeHeaders +from gunicorn.http.errors import InvalidProxyHeader, InvalidProxyLine why this change?

— Reply to this email directly, view it on GitHub https://github.com/benoitc/gunicorn/pull/2912#pullrequestreview-1271924841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAT5CYW2LSNEINFOKYW7VDWUMCV3ANCNFSM6AAAAAATO7BUDE. You are receiving this because you authored the thread.Message ID: @.***>

apollo13 avatar Jan 27 '23 06:01 apollo13

Very cool to have this feature!

frittentheke avatar Feb 22 '23 12:02 frittentheke

Hi @sirkonst and @benoitc -- sorry for the late reply; I have lost track here. I'll update and address the comments today. In the meantime it would be great if you could review #2913, due to the bugs in Unreader (at least if I understood the purpose of it correctly) I was not able to utilize it in this PR properly.

apollo13 avatar May 21 '23 07:05 apollo13

I think I have addressed all comments, as far as I can see the linting errors are coming from other files. Let me know what you think.

apollo13 avatar May 21 '23 08:05 apollo13