summaryrefslogtreecommitdiff
path: root/src/test/burn/WixToolsetTest.BurnE2E/WebServer
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 /src/test/burn/WixToolsetTest.BurnE2E/WebServer
parentf322cf875bf9a02c9ab7518b2c48ec11d91f5531 (diff)
downloadwix-7750404222a7c5bb6543dd246c2cce0f7c097d8d.tar.gz
wix-7750404222a7c5bb6543dd246c2cce0f7c097d8d.tar.bz2
wix-7750404222a7c5bb6543dd246c2cce0f7c097d8d.zip
Ignore HEAD request failure in dlutil's DownloadUrl.
Fixes #6331
Diffstat (limited to 'src/test/burn/WixToolsetTest.BurnE2E/WebServer')
-rw-r--r--src/test/burn/WixToolsetTest.BurnE2E/WebServer/CoreOwinWebServer.cs22
1 files changed, 20 insertions, 2 deletions
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