@joebigelow / wix-1 / commits / f94e47a9

Parse the Content-Length string value to avoid the 2GB limitation.

Sean Hall committed Feb 18, 2022 at 19:00 UTC f94e47a9e1b6d4366e5d2c8e850067204d0c5dc9
2 files changed +8 -10
src/libs/dutil/WixToolset.DUtil/inetutil.cpp
+6 -8
@@ -30,16 +30,14 @@ extern "C" HRESULT DAPI InternetGetSizeByHandle(
30 Assert(pllSize);
31
32 HRESULT hr = S_OK;
33 - DWORD dwSize = 0;
34 - DWORD cb = 0;
33 + LPWSTR sczValue = NULL;
34
36 - cb = sizeof(dwSize);
37 - if (!::HttpQueryInfoW(hiFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, reinterpret_cast<LPVOID>(&dwSize), &cb, NULL))
38 - {
39 - InetExitOnLastError(hr, "Failed to get size for internet file handle");
40 - }
35 + hr = InternetQueryInfoString(hiFile, HTTP_QUERY_CONTENT_LENGTH, &sczValue);
36 + InetExitOnLastError(hr, "Failed to get content length string for internet file handle");
37 +
38 + hr = StrStringToInt64(sczValue, 0, pllSize);
39 + InetExitOnLastError(hr, "Failed to parse size for internet file handle: %ls", sczValue);
40
42 - *pllSize = dwSize;
41 LExit:
42 return hr;
43 }
src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs
+2 -2
@@ -110,7 +110,7 @@ namespace WixToolsetTest.BurnE2E
110 }
111
112 Assert.False(LogVerifier.MessageInLogFile(logPath, "Range request not supported for URL: http://localhost:9999/e2e/BundleC/fivegb.file"));
113 - Assert.True(LogVerifier.MessageInLogFile(logPath, "Content-Length not returned for URL: http://localhost:9999/e2e/BundleC/fivegb.file"));
113 + Assert.False(LogVerifier.MessageInLogFile(logPath, "Content-Length not returned for URL: http://localhost:9999/e2e/BundleC/fivegb.file"));
114 }
115
116 [Fact]
@@ -123,7 +123,7 @@ namespace WixToolsetTest.BurnE2E
123 }
124
125 Assert.True(LogVerifier.MessageInLogFile(logPath, "Range request not supported for URL: http://localhost:9999/e2e/BundleC/fivegb.file"));
126 - Assert.True(LogVerifier.MessageInLogFile(logPath, "Content-Length not returned for URL: http://localhost:9999/e2e/BundleC/fivegb.file"));
126 + Assert.False(LogVerifier.MessageInLogFile(logPath, "Content-Length not returned for URL: http://localhost:9999/e2e/BundleC/fivegb.file"));
127 }
128
129 [Fact]