Closed Montclair closed 2 years ago
It looks like WinHttpRequest
client sends Content-Length
header for every method which is not GET
even if there is no body passed to Send
call -- it just sends 0
for Content-Length
.
Fixed in 13532ff07311c703502deff6309e6887188da5c2
Tested and works. Thanks!
I'm rewriting an interface to a supplier's XML server. We currently test if their server is up by sending an empty payload via post. When we do this using WinHTTP, we get a "400 Bad Request" response which is what we expect. When using cHttpRequest, we get a "411 Length Required" response. It's not a big deal at all to test for either of those, but I thought you might want to know of the behavior difference. WinHTTP is probably setting the request header content-length to zero. I think the issue is here in your "Send" function, where it omits the header entirely -- but that's just a guess:
Not a big deal and technically what you have is probably correct, but I thought you might like to know of the difference, so as to make this as compatible as possible with existing WinHTTP behavior.
Maybe a patch to
EDIT: I made this patch locally and now the behavior is consistent with WinHTTP.