I expect a response from the server after sending it some data with HttpSendRequest() function. I want to read the response, I call the
HttpQueryInfo() function, and the debugger stops with
Exception thrown ... Access violation reading location 0x00000800 message. I'd use the buffer array for the response, and I assume the problem is somewhere there. I don't get any errors with the GetLastError() function.
else if (method == _T("POST")) {
LPCTSTR header = _T("Content-Type: text/html\nCustomers");
BOOL hHttpSendReq = HttpSendRequest(hHttpOpenReq, NULL, NULL, toSend, strlen(toSend));
if (!hHttpSendReq) {
DWORD ErrorNum = GetLastError();
std::cout << "HttpSendRequest() error No: " << ErrorNum;
InternetCloseHandle(hHttpOpenReq);
InternetCloseHandle(hIntConnect);
InternetCloseHandle(hIntOpen);
getchar();
return 0;
}
char buffer[2048];
if (HttpQueryInfo(hHttpOpenReq, HTTP_QUERY_RAW_HEADERS_CRLF, buffer, (LPDWORD)2048, NULL)) {
}
else {
cout << "GetLastError:"<<GetLastError();
}
In the debugger 'buffer' is shown red, and there is no content in there, only funny characters.
Any idea? Thanks.
What I have tried:
I don't know where to look, I checked some examples on the net, but they look similar. I also changed the flags (arguments), but I don't think the problem is there anyway.