Im trying to use WinHttpQueryHeaders to display the response headers so i can copy some of the data, but im not getting the correct headers that i should be getting.
This is what my app prints to cmd:
This is what my packet sniffer receives from the winhttp request, & what i need:Code:Header contents: HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Cache-control: no-cache, no-store Pragma: no-cache Expires: Mon, 01-Jan-1990 00:00:00 GMT X-Content-Type-Options: nosniff
Code:- Http: Response, HTTP/1.1, Status Code = 302, URL: "URL" ProtocolVersion: HTTP/1.1 StatusCode: 302, Moved temporarily Reason: Moved Temporarily Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: Fri, 01 Jan 1990 00:00:00 GMT Date: Mon, 17 Aug 2009 15:31:35 GMT Location: "redirect URL" + ContentType: text/html; charset=UTF-8 X-Content-Type-Options: nosniff TransferEncoding: chunked HeaderEnd: CRLF + chunkSize: 378 + ChunkPayload: HttpContentType = text/html; charset=UTF-8 FooterEnd: CRLF ChunkEnd: 0 FooterEnd: CRLF
Code:bResults = WinHttpReceiveResponse(hRequest, NULL); if (bResults) { WinHttpQueryHeaders( hRequest, WINHTTP_QUERY_RAW_HEADERS_CRLF, WINHTTP_HEADER_NAME_BY_INDEX, NULL, &dwSize, WINHTTP_NO_HEADER_INDEX); if( GetLastError( ) == ERROR_INSUFFICIENT_BUFFER ) { lpOutBuffer = new WCHAR[dwSize/sizeof(WCHAR)]; // Now, use WinHttpQueryHeaders to retrieve the header. bResults = WinHttpQueryHeaders( hRequest, WINHTTP_QUERY_RAW_HEADERS_CRLF, WINHTTP_HEADER_NAME_BY_INDEX, lpOutBuffer, &dwSize, WINHTTP_NO_HEADER_INDEX); } }




Reply With Quote
