253a001ebc
The read() in readall() to read the SOCKS4a request was sometimes failing with EAGAIN, which it wasn't prepared for, causing the request to be rejected and the test to fail. I wrote this code specifically under the assumption the fd would be in blocking mode, and in the original draft I wrote with stdin/stdout under socat that was true. But when I adapted this to do its own bind/listen/accept logic, I broke it, because POSIX leaves it unspecified whether accept() inherits the O_NONBLOCK setting or not: https://pubs.opengroup.org/onlinepubs/9799919799/functions/accept4.html And the traditional BSD semantics is to inherit O_NONBLOCK. So, just explicitly clear O_NONBLOCK on the fd returned by accept().