问题
I need to be able to log the outgoing request, which I am sending using winhttp. Everything else is easy to get (status code, content, response headers, etc) but there appears to be absolutely no way to see what winhttp is actually sending in the request headers.
I need to log the request headers because it contains a cookie from the login's set-cookie, but which is being rejected for unknown reasons from the application, whereas the same urls succeed in a browser.
I had to convert an older program based on afxinet because it needed to run as a service, which that interface can't do, so I moved to winhttp. Unfortunately winhttp has this glaring flaw in the api. Am I missing something, or is there a better option than winhttp? I could convert to curl if winhttp can't do this.
回答1:
WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_FLAG_REQUEST_HEADERS ...
See https://msdn.microsoft.com/en-us/library/aa384102.aspx
来源:https://stackoverflow.com/questions/37120655/how-do-i-get-the-request-headers-of-a-winhttp-request