"Connection: Close" header for WinInet in C++
Posted on 2002-03-30
I want to add the "Connection: Close" header in a request to be sent to a server. However, it doesn't seem to be sent using the WinInet functions (and the connection is kept alive). When I try the "Connection: Keep-Alive" header, it is sent for sure.
For example, I have:
headers = "Connection: Close\r\n"; // this header is not sent
// headers = "Connection: Keep-Alive\r\n"; // this header is sent
// hRequest defined as HINTERNET, returned from HttpOpenRequest()
HttpAddRequestHeaders(hRequest, headers.c_str(), headers.length(), HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
// This also won't send "Connection: Close"
// HttpSendRequest(hRequest, headers.c_str(), headers.length(), NULL, 0);
I've only tried HttpAddRequestHeaders() and HttpSendRequest(). Is there another function, flag, etc. to forcefully add the "Connection: Close" header to a request?