summaryrefslogtreecommitdiff
path: root/src/ext/Http/wixext/HttpCompiler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext/Http/wixext/HttpCompiler.cs')
-rw-r--r--src/ext/Http/wixext/HttpCompiler.cs31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/ext/Http/wixext/HttpCompiler.cs b/src/ext/Http/wixext/HttpCompiler.cs
index 51fdfebc..27ddeb0e 100644
--- a/src/ext/Http/wixext/HttpCompiler.cs
+++ b/src/ext/Http/wixext/HttpCompiler.cs
@@ -49,7 +49,11 @@ namespace WixToolset.Http
49 switch (element.Name.LocalName) 49 switch (element.Name.LocalName)
50 { 50 {
51 case "SniSslCertificate": 51 case "SniSslCertificate":
52 this.ParseSniSslCertificateElement(intermediate, section, element, componentId); 52 this.ParseCertificateElement(intermediate, section, element, componentId, CertificateType.SniSsl);
53 break;
54
55 case "SslCertificate":
56 this.ParseCertificateElement(intermediate, section, element, componentId, CertificateType.IpSsl);
53 break; 57 break;
54 58
55 case "UrlReservation": 59 case "UrlReservation":
@@ -71,7 +75,7 @@ namespace WixToolset.Http
71 /// </summary> 75 /// </summary>
72 /// <param name="node">The element to parse.</param> 76 /// <param name="node">The element to parse.</param>
73 /// <param name="componentId">Identifier of the component that owns this SNI SSL Certificate.</param> 77 /// <param name="componentId">Identifier of the component that owns this SNI SSL Certificate.</param>
74 private void ParseSniSslCertificateElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentId) 78 private void ParseCertificateElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentId, CertificateType type)
75 { 79 {
76 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); 80 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
77 Identifier id = null; 81 Identifier id = null;
@@ -138,13 +142,25 @@ namespace WixToolset.Http
138 // Need the element ID for child element processing, so generate now if not authored. 142 // Need the element ID for child element processing, so generate now if not authored.
139 if (null == id) 143 if (null == id)
140 { 144 {
141 id = this.ParseHelper.CreateIdentifier("ssl", componentId, host, port); 145 var prefix = type == CertificateType.IpSsl ? "ips" : "sni";
146
147 id = this.ParseHelper.CreateIdentifier(prefix, componentId, host, port);
142 } 148 }
143 149
144 // Required attributes. 150 // Required attributes.
145 if (null == host) 151 if (null == host)
146 { 152 {
147 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Host")); 153 if (type == CertificateType.SniSsl)
154 {
155 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Host"));
156 }
157 }
158 else
159 {
160 if (type == CertificateType.IpSsl)
161 {
162 this.Messaging.Write(ErrorMessages.IllegalAttributeExceptOnElement(sourceLineNumbers, node.Name.LocalName, "Host", "SniSslCertificate"));
163 }
148 } 164 }
149 165
150 if (null == port) 166 if (null == port)
@@ -162,7 +178,7 @@ namespace WixToolset.Http
162 178
163 if (!this.Messaging.EncounteredError) 179 if (!this.Messaging.EncounteredError)
164 { 180 {
165 section.AddSymbol(new WixHttpSniSslCertSymbol(sourceLineNumbers, id) 181 section.AddSymbol(new HttpCertificateSymbol(sourceLineNumbers, id)
166 { 182 {
167 Host = host, 183 Host = host,
168 Port = port, 184 Port = port,
@@ -170,11 +186,12 @@ namespace WixToolset.Http
170 AppId = appId, 186 AppId = appId,
171 Store = store, 187 Store = store,
172 HandleExisting = handleExisting, 188 HandleExisting = handleExisting,
189 CertificateType = type,
173 ComponentRef = componentId, 190 ComponentRef = componentId,
174 }); 191 });
175 192
176 this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4SchedHttpSniSslCertsInstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); 193 this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix6SchedHttpCertificatesInstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64);
177 this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4SchedHttpSniSslCertsUninstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); 194 this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix6SchedHttpCertificatesUninstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64);
178 } 195 }
179 } 196 }
180 197