MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / WinHTTPQueryOptionString

Function WinHTTPQueryOptionString

Sources/Shared/IO/WebRequest.cpp:1806–1823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1804 }
1805
1806 String WinHTTPQueryOptionString(HINTERNET hInternet, DWORD dwOption)
1807 {
1808 String result;
1809 DWORD bufferLength = 0;
1810 WinHTTP::WinHttpQueryOption(hInternet, dwOption, nullptr, &bufferLength);
1811 if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
1812 if (bufferLength == 0 || (bufferLength % sizeof(wchar_t)) != 0) {
1813 return {};
1814 }
1815
1816 SmallVector<wchar_t, 1000> buffer(bufferLength / sizeof(wchar_t));
1817 if (WinHTTP::WinHttpQueryOption(hInternet, dwOption, buffer.data(), &bufferLength)) {
1818 result = Utf8::FromUtf16(buffer.data(), bufferLength);
1819 }
1820 }
1821
1822 return result;
1823 }
1824
1825 inline void WinHTTPSetOption(HINTERNET hInternet, DWORD dwOption, DWORD dwValue)
1826 {

Callers 1

GetURLMethod · 0.85

Calls 2

FromUtf16Function · 0.50
dataMethod · 0.45

Tested by

no test coverage detected