Closed TimWolla closed 4 years ago
Hey Tim, I'll investigate this more thoroughly, but from the quick glance of the code, we don't specifically handle responses to HEAD requests, and this specific error is returned by underlying socket:receive("*a")
Aside from that, we do need some light testing harness for this library, maybe something like httpbin.org or similar.
Hey Tim, I'll investigate this more thoroughly, but from the quick glance of the code, we don't specifically handle responses to HEAD requests, and this specific error is returned by underlying socket:receive("*a")
Yes, that's what I concluded as well. I didn't create a PR, because I did have the time to investigate the proper solution.
Aside from that, we do need some light testing harness for this library, maybe something like httpbin.org or similar.
I suggest VTest as with HAProxy itself. I plan to use that for my haproxy-auth-request as well, when I get around to it.
@anezirovic You might be interested in this: https://github.com/TimWolla/haproxy-auth-request/blob/master/.github/workflows/vtest.yml
Maybe the HAProxy installation and VTest installation steps could be spun out into an includeable action within either the haproxytech or the haproxy organization (I would prefer the latter). Documentation is here: https://help.github.com/en/actions/building-actions
Do you have an update to share / did you get around to working on this, yet?
Hey Tim, the issue was rather trivial, forgot to push the fix long time ago. We just need to be sure not to consume response body (if any) for HEAD requests. request.content attribute will be explicitly set to nil as well (so if you use core.Info(), please guard it with tostring()).
I've never used HEAD in my haproxy Lua code, I feel embarrassed.
If this works for you, we will close the issue.
so if you use core.Info(), please guard it with tostring()
I don't. This was just my my simple reproducer. In fact I don't care about the body at all (that's why I've been using a HEAD request).
If this works for you, we will close the issue.
Yes, this is looking good on the system where I've been seeing the issue. You can close this (and label as “fixed” or whatever).
Example configuration:
Now making a request to
localhost:8080
will log the following:RFC 7230#3.3.2 says:
and that's what the example.com server is doing: It's sending a non-zero
Content-Length
in response to theHEAD
request, leading to haproxy-lua-http falling over.