Hello
I've been studying the documentation at http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt and have found that in the code sample at the bottom there is a bug. This is also present in version 1.7 of the documentation: i haven't looked any further back than that. The line
size = 16 + hdr.v2.len;
needs to convert the value of hdr.v2.len to a host short, so it should be
size = 16 + ntohs(hdr.v2.len);
This isn't a major problem, as when stepping through the code the problem can be quite quickly spotted, but it just seems a shame to have this little error spoil what is an excellent example.
Sorry if this has been mentioned before; I did take a look but couldn't find any mention of it.
Thanks.
I've been studying the documentation at http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt and have found that in the code sample at the bottom there is a bug. This is also present in version 1.7 of the documentation: i haven't looked any further back than that. The line
size = 16 + hdr.v2.len;
needs to convert the value of hdr.v2.len to a host short, so it should be
size = 16 + ntohs(hdr.v2.len);
This isn't a major problem, as when stepping through the code the problem can be quite quickly spotted, but it just seems a shame to have this little error spoil what is an excellent example.
Sorry if this has been mentioned before; I did take a look but couldn't find any mention of it.
Thanks.