How do I get the request headers of a WINHTTP request?

落花浮王杯 提交于 2019-12-24 06:29:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!