MCPcopy Create free account
hub / github.com/Norbyte/ositools / SendRequest

Method SendRequest

OsiLoader/HttpFetcher.cpp:53–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53bool HttpFetcher::SendRequest(HINTERNET request, wchar_t const * path)
54{
55 auto sent = WinHttpSendRequest(request, WINHTTP_NO_ADDITIONAL_HEADERS, -1l,
56 WINHTTP_NO_REQUEST_DATA, 0, 0, NULL);
57 if (sent != TRUE) {
58 return false;
59 }
60
61 auto recvdHeaders = WinHttpReceiveResponse(request, NULL);
62 if (recvdHeaders != TRUE) {
63 return false;
64 }
65
66 wchar_t statusCode[4];
67 DWORD statusCodeLength = sizeof(statusCode);
68 auto gotStatus = WinHttpQueryHeaders(request, WINHTTP_QUERY_STATUS_CODE,
69 WINHTTP_HEADER_NAME_BY_INDEX, statusCode, &statusCodeLength, 0);
70 if (gotStatus != TRUE) {
71 return false;
72 }
73
74 if (wcscmp(statusCode, L"200") != 0) {
75 return false;
76 }
77
78 return true;
79}
80
81bool HttpFetcher::FetchBody(HINTERNET request, std::vector<uint8_t> & response)
82{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected