1

The title pretty much says it all; It's easy enough to get the size of the headers in the server's response from WinHttp, but I need to know the TOTAL size of my request, including the HTTP version, verb, URL, and any random stuff the API is probably adding. I know there's an 8k limit to the total size of a single request, but providing 8k of headers results in an error.

Do I really have to manually add up all the stuff required by the HTTP standard to get the total request size? Seems like there ought to be a function.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
sqykly
  • 1,586
  • 10
  • 16

2 Answers2

2

Actually, it depends on the task. For example, I need to count my traffic. Only I could do it had been to calculate my request body size plus my additional header params. I think it's all for out-coming traffic with WinHttp.

Joseph Quinsey
  • 9,553
  • 10
  • 54
  • 77
Sergey
  • 21
  • 2
1

WinHTTP API creates request line and headers for you, with options to provide custom headers etc. If you need to provide a header which indicates body length, you can do it too, e.g. by providing Content-Length header with your request to be sent. You don't need to calculate the total, API does this request/response management for you.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • I am aware that I have no need to provide it to the API in order to send the request and respond, and that the aforementioned header requires only that I know the body length. The question is not "do I need the total size for any obvious purpose?", however. It is "I *do* need the total size for a less obvious unspecified purpose; how do I get it?". I actually *don't* need it anymore, but I still have a check mark for an answer if you've got it. – sqykly Aug 06 '15 at 06:53