DOC: update sample code for PROXY protocol

lengths are in network byte order so use ntohs(hdr.v2.len)
when calculating size of v2 header to recv() from head of stream.
This commit is contained in:
Glenn Strauss 2017-04-05 01:37:20 -04:00 committed by Willy Tarreau
parent e5ae702222
commit 91cc8081a2

View File

@ -970,7 +970,7 @@ side is even simpler and can easily be deduced from this sample code.
if (ret >= 16 && memcmp(&hdr.v2, v2sig, 12) == 0 &&
(hdr.v2.ver_cmd & 0xF0) == 0x20) {
size = 16 + hdr.v2.len;
size = 16 + ntohs(hdr.v2.len);
if (ret < size)
return -1; /* truncated or too large header */