Added support for proxy protocol v2.
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.
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: @.***>
Very cool to have this feature!
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.
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.