aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-02-18 17:41:43 -0600
committerSean Hall <r.sean.hall@gmail.com>2022-02-19 11:53:06 -0700
commit7750404222a7c5bb6543dd246c2cce0f7c097d8d (patch)
tree823bb221de9413cfad1a7d5999e4045cd7dee160
parentf322cf875bf9a02c9ab7518b2c48ec11d91f5531 (diff)
downloadwix-7750404222a7c5bb6543dd246c2cce0f7c097d8d.tar.gz
wix-7750404222a7c5bb6543dd246c2cce0f7c097d8d.tar.bz2
wix-7750404222a7c5bb6543dd246c2cce0f7c097d8d.zip
Ignore HEAD request failure in dlutil's DownloadUrl.
Fixes #6331
-rw-r--r--src/libs/dutil/WixToolset.DUtil/dlutil.cpp5
-rw-r--r--src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs5
-rw-r--r--src/test/burn/WixToolsetTest.BurnE2E/IWebServer.cs2
-rw-r--r--src/test/burn/WixToolsetTest.BurnE2E/WebServer/CoreOwinWebServer.cs22
4 files changed, 30 insertions, 4 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/dlutil.cpp b/src/libs/dutil/WixToolset.DUtil/dlutil.cpp
index 70155e6f..f6b793b2 100644
--- a/src/libs/dutil/WixToolset.DUtil/dlutil.cpp
+++ b/src/libs/dutil/WixToolset.DUtil/dlutil.cpp
@@ -158,7 +158,10 @@ extern "C" HRESULT DAPI DownloadUrl(
158 158
159 // Get the resource size and creation time from the internet. 159 // Get the resource size and creation time from the internet.
160 hr = GetResourceMetadata(hSession, &sczUrl, pDownloadSource->sczUser, pDownloadSource->sczPassword, pAuthenticate, &dw64Size, &ftCreated); 160 hr = GetResourceMetadata(hSession, &sczUrl, pDownloadSource->sczUser, pDownloadSource->sczPassword, pAuthenticate, &dw64Size, &ftCreated);
161 DlExitOnFailure(hr, "Failed to get size and time for URL: %ls", sczUrl); 161 if (FAILED(hr))
162 {
163 LogStringLine(REPORT_VERBOSE, "Ignoring failure to get size and time for URL: %ls (error 0x%x)", sczUrl, hr);
164 }
162 165
163 // Ignore failure to initialize resume because we will fall back to full download then 166 // Ignore failure to initialize resume because we will fall back to full download then
164 // download. 167 // download.
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs
index 953aed2e..4a3ffa2e 100644
--- a/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs
+++ b/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs
@@ -67,6 +67,7 @@ namespace WixToolsetTest.BurnE2E
67 { "/BundleA/PackageA.msi", Path.Combine(this.TestContext.TestDataFolder, "PackageA.msi") }, 67 { "/BundleA/PackageA.msi", Path.Combine(this.TestContext.TestDataFolder, "PackageA.msi") },
68 { "/BundleA/PackageB.msi", Path.Combine(this.TestContext.TestDataFolder, "PackageB.msi") }, 68 { "/BundleA/PackageB.msi", Path.Combine(this.TestContext.TestDataFolder, "PackageB.msi") },
69 }); 69 });
70 webServer.DisableHeadResponses = true;
70 webServer.Start(); 71 webServer.Start();
71 72
72 // Don't install PackageB initially so it will be installed when run from the package cache. 73 // Don't install PackageB initially so it will be installed when run from the package cache.
@@ -95,11 +96,13 @@ namespace WixToolsetTest.BurnE2E
95 96
96 testBAController.SetPackageRequestedState("PackageB", RequestState.Present); 97 testBAController.SetPackageRequestedState("PackageB", RequestState.Present);
97 98
98 bundleA.Modify(bundlePackageCachePath); 99 var modifyLogPath = bundleA.Modify(bundlePackageCachePath);
99 bundleA.VerifyRegisteredAndInPackageCache(); 100 bundleA.VerifyRegisteredAndInPackageCache();
100 101
101 packageA.VerifyInstalled(true); 102 packageA.VerifyInstalled(true);
102 packageB.VerifyInstalled(true); 103 packageB.VerifyInstalled(true);
104
105 Assert.True(LogVerifier.MessageInLogFile(modifyLogPath, "Ignoring failure to get size and time for URL: http://localhost:9999/e2e/BundleA/PackageB.msi (error 0x80070002)"));
103 } 106 }
104 107
105 [Fact] 108 [Fact]
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/IWebServer.cs b/src/test/burn/WixToolsetTest.BurnE2E/IWebServer.cs
index 3bb8a23e..3846ae94 100644
--- a/src/test/burn/WixToolsetTest.BurnE2E/IWebServer.cs
+++ b/src/test/burn/WixToolsetTest.BurnE2E/IWebServer.cs
@@ -7,6 +7,8 @@ namespace WixToolsetTest.BurnE2E
7 7
8 public interface IWebServer : IDisposable 8 public interface IWebServer : IDisposable
9 { 9 {
10 bool DisableHeadResponses { get; set; }
11
10 /// <summary> 12 /// <summary>
11 /// Registers a collection of relative URLs (the key) with its absolute path to the file (the value). 13 /// Registers a collection of relative URLs (the key) with its absolute path to the file (the value).
12 /// </summary> 14 /// </summary>
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/WebServer/CoreOwinWebServer.cs b/src/test/burn/WixToolsetTest.BurnE2E/WebServer/CoreOwinWebServer.cs
index 89825813..025e01ff 100644
--- a/src/test/burn/WixToolsetTest.BurnE2E/WebServer/CoreOwinWebServer.cs
+++ b/src/test/burn/WixToolsetTest.BurnE2E/WebServer/CoreOwinWebServer.cs
@@ -7,6 +7,7 @@ namespace WixToolsetTest.BurnE2E
7 using System.IO; 7 using System.IO;
8 using Microsoft.AspNetCore.Builder; 8 using Microsoft.AspNetCore.Builder;
9 using Microsoft.AspNetCore.Hosting; 9 using Microsoft.AspNetCore.Hosting;
10 using Microsoft.AspNetCore.StaticFiles;
10 using Microsoft.Extensions.FileProviders; 11 using Microsoft.Extensions.FileProviders;
11 using Microsoft.Extensions.FileProviders.Physical; 12 using Microsoft.Extensions.FileProviders.Physical;
12 using Microsoft.Extensions.Hosting; 13 using Microsoft.Extensions.Hosting;
@@ -18,6 +19,8 @@ namespace WixToolsetTest.BurnE2E
18 19
19 private IHost WebHost { get; set; } 20 private IHost WebHost { get; set; }
20 21
22 public bool DisableHeadResponses { get; set; }
23
21 public void AddFiles(Dictionary<string, string> physicalPathsByRelativeUrl) 24 public void AddFiles(Dictionary<string, string> physicalPathsByRelativeUrl)
22 { 25 {
23 foreach (var kvp in physicalPathsByRelativeUrl) 26 foreach (var kvp in physicalPathsByRelativeUrl)
@@ -40,6 +43,7 @@ namespace WixToolsetTest.BurnE2E
40 FileProvider = this, 43 FileProvider = this,
41 RequestPath = "/e2e", 44 RequestPath = "/e2e",
42 ServeUnknownFileTypes = true, 45 ServeUnknownFileTypes = true,
46 OnPrepareResponse = this.OnPrepareStaticFileResponse,
43 }); 47 });
44 }); 48 });
45 }) 49 })
@@ -47,13 +51,24 @@ namespace WixToolsetTest.BurnE2E
47 this.WebHost.Start(); 51 this.WebHost.Start();
48 } 52 }
49 53
54 private void OnPrepareStaticFileResponse(StaticFileResponseContext obj)
55 {
56 if (this.DisableHeadResponses && obj.Context.Request.Method == "HEAD")
57 {
58 obj.Context.Response.StatusCode = 404;
59 }
60 }
61
50 public void Dispose() 62 public void Dispose()
51 { 63 {
52 var waitTime = TimeSpan.FromSeconds(5); 64 var waitTime = TimeSpan.FromSeconds(5);
53 this.WebHost?.StopAsync(waitTime).Wait(waitTime); 65 this.WebHost?.StopAsync(waitTime).Wait(waitTime);
54 } 66 }
55 67
56 public IDirectoryContents GetDirectoryContents(string subpath) => throw new NotImplementedException(); 68 public IDirectoryContents GetDirectoryContents(string subpath)
69 {
70 throw new NotImplementedException();
71 }
57 72
58 public IFileInfo GetFileInfo(string subpath) 73 public IFileInfo GetFileInfo(string subpath)
59 { 74 {
@@ -65,6 +80,9 @@ namespace WixToolsetTest.BurnE2E
65 return new NotFoundFileInfo(subpath); 80 return new NotFoundFileInfo(subpath);
66 } 81 }
67 82
68 public IChangeToken Watch(string filter) => throw new NotImplementedException(); 83 public IChangeToken Watch(string filter)
84 {
85 throw new NotImplementedException();
86 }
69 } 87 }
70} \ No newline at end of file 88} \ No newline at end of file