Open Tieske opened 8 months ago
There seems to be a bit more to it: https://stackoverflow.com/questions/67727200/is-reading-zero-bytes-from-a-socket-a-valid-way-for-monitoring-a-tcp-ip-discon, so now I have doubts whether this actually is a bug, or as designed.
I think the proper thing to do depends on whether we have info on the state of the socket.
When reading from a socket, 0 bytes, it blocks until data becomes available on the socket.
I ran into this due to a compatibility issue between OpenResty and LuaSocket. The http client in use simply reads the body based on the
Content-Length
header, even if that is 0. This returned ustimeout
errors when LuaSocket was in use, but not with the OpenResty sockets.To reproduce (using Copas for the server):
Using openresty for the Client:
What the code does:
Here's the client output:
Note that LuaSocket also returns the time it took (OpenResty doesn't).