From f94e47a9e1b6d4366e5d2c8e850067204d0c5dc9 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 18 Feb 2022 19:00:23 -0600 Subject: Parse the Content-Length string value to avoid the 2GB limitation. --- src/libs/dutil/WixToolset.DUtil/inetutil.cpp | 14 ++++++-------- src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/libs/dutil/WixToolset.DUtil/inetutil.cpp b/src/libs/dutil/WixToolset.DUtil/inetutil.cpp index 8dace55f..c4cddd11 100644 --- a/src/libs/dutil/WixToolset.DUtil/inetutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/inetutil.cpp @@ -30,16 +30,14 @@ extern "C" HRESULT DAPI InternetGetSizeByHandle( Assert(pllSize); HRESULT hr = S_OK; - DWORD dwSize = 0; - DWORD cb = 0; + LPWSTR sczValue = NULL; - cb = sizeof(dwSize); - if (!::HttpQueryInfoW(hiFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, reinterpret_cast(&dwSize), &cb, NULL)) - { - InetExitOnLastError(hr, "Failed to get size for internet file handle"); - } + hr = InternetQueryInfoString(hiFile, HTTP_QUERY_CONTENT_LENGTH, &sczValue); + InetExitOnLastError(hr, "Failed to get content length string for internet file handle"); + + hr = StrStringToInt64(sczValue, 0, pllSize); + InetExitOnLastError(hr, "Failed to parse size for internet file handle: %ls", sczValue); - *pllSize = dwSize; LExit: return hr; } diff --git a/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs index ee61baff..943939e3 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs @@ -110,7 +110,7 @@ namespace WixToolsetTest.BurnE2E } Assert.False(LogVerifier.MessageInLogFile(logPath, "Range request not supported for URL: http://localhost:9999/e2e/BundleC/fivegb.file")); - Assert.True(LogVerifier.MessageInLogFile(logPath, "Content-Length not returned for URL: http://localhost:9999/e2e/BundleC/fivegb.file")); + Assert.False(LogVerifier.MessageInLogFile(logPath, "Content-Length not returned for URL: http://localhost:9999/e2e/BundleC/fivegb.file")); } [Fact] @@ -123,7 +123,7 @@ namespace WixToolsetTest.BurnE2E } Assert.True(LogVerifier.MessageInLogFile(logPath, "Range request not supported for URL: http://localhost:9999/e2e/BundleC/fivegb.file")); - Assert.True(LogVerifier.MessageInLogFile(logPath, "Content-Length not returned for URL: http://localhost:9999/e2e/BundleC/fivegb.file")); + Assert.False(LogVerifier.MessageInLogFile(logPath, "Content-Length not returned for URL: http://localhost:9999/e2e/BundleC/fivegb.file")); } [Fact] -- cgit v1.2.3-55-g6feb