Skip to content

Commit

Permalink
With help from @plevy, enabling automatic decompression in HTTPClient
Browse files Browse the repository at this point in the history
when building osgEarth with OSGEARTH_USE_WININET_FOR_HTTP support.
  • Loading branch information
jasonbeverage committed Sep 6, 2024
1 parent 097b8b5 commit 4314f48
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/osgEarth/HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,10 @@ namespace
return HTTPResponse(0);
}

// Enable automatic HTTP decompression of known types.
BOOL enableDecompression = TRUE;
InternetSetOption(hConnection, INTERNET_OPTION_HTTP_DECODING, &enableDecompression, sizeof(enableDecompression));

HINTERNET hRequest = HttpOpenRequest(
hConnection, // handle from InternetConnect
"GET", // verb
Expand All @@ -1075,7 +1079,8 @@ namespace
return HTTPResponse(0);
}

while( !HttpSendRequest(hRequest, NULL, 0, NULL, 0) )
const char* headers = "Accept-Encoding: gzip, deflate";
while( !HttpSendRequest(hRequest, headers, strlen(headers), NULL, 0) )
{
DWORD errorNum = GetLastError();

Expand Down

0 comments on commit 4314f48

Please sign in to comment.