diff options
Diffstat (limited to 'src/wixext/HttpCompiler.cs')
| -rw-r--r-- | src/wixext/HttpCompiler.cs | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/src/wixext/HttpCompiler.cs b/src/wixext/HttpCompiler.cs index cb217147..6c572470 100644 --- a/src/wixext/HttpCompiler.cs +++ b/src/wixext/HttpCompiler.cs | |||
| @@ -48,6 +48,10 @@ namespace WixToolset.Http | |||
| 48 | 48 | ||
| 49 | switch (element.Name.LocalName) | 49 | switch (element.Name.LocalName) |
| 50 | { | 50 | { |
| 51 | case "SniSslCertificate": | ||
| 52 | this.ParseSniSslCertificateElement(intermediate, section, element, componentId); | ||
| 53 | break; | ||
| 54 | |||
| 51 | case "UrlReservation": | 55 | case "UrlReservation": |
| 52 | this.ParseUrlReservationElement(intermediate, section, element, componentId, null); | 56 | this.ParseUrlReservationElement(intermediate, section, element, componentId, null); |
| 53 | break; | 57 | break; |
| @@ -63,6 +67,119 @@ namespace WixToolset.Http | |||
| 63 | } | 67 | } |
| 64 | 68 | ||
| 65 | /// <summary> | 69 | /// <summary> |
| 70 | /// Parses a SniSsl element. | ||
| 71 | /// </summary> | ||
| 72 | /// <param name="node">The element to parse.</param> | ||
| 73 | /// <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) | ||
| 75 | { | ||
| 76 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | ||
| 77 | Identifier id = null; | ||
| 78 | string host = null; | ||
| 79 | string port = null; | ||
| 80 | string appId = null; | ||
| 81 | string store = null; | ||
| 82 | string thumbprint = null; | ||
| 83 | var handleExisting = HandleExisting.Replace; | ||
| 84 | string handleExistingValue = null; | ||
| 85 | |||
| 86 | foreach (var attrib in node.Attributes()) | ||
| 87 | { | ||
| 88 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | ||
| 89 | { | ||
| 90 | switch (attrib.Name.LocalName) | ||
| 91 | { | ||
| 92 | case "Id": | ||
| 93 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); | ||
| 94 | break; | ||
| 95 | case "AppId": | ||
| 96 | appId = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 97 | break; | ||
| 98 | case "HandleExisting": | ||
| 99 | handleExistingValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 100 | switch (handleExistingValue) | ||
| 101 | { | ||
| 102 | case "replace": | ||
| 103 | handleExisting = HandleExisting.Replace; | ||
| 104 | break; | ||
| 105 | case "ignore": | ||
| 106 | handleExisting = HandleExisting.Ignore; | ||
| 107 | break; | ||
| 108 | case "fail": | ||
| 109 | handleExisting = HandleExisting.Fail; | ||
| 110 | break; | ||
| 111 | default: | ||
| 112 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "HandleExisting", handleExistingValue, "replace", "ignore", "fail")); | ||
| 113 | break; | ||
| 114 | } | ||
| 115 | break; | ||
| 116 | case "Host": | ||
| 117 | host = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 118 | break; | ||
| 119 | case "Port": | ||
| 120 | port = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 121 | break; | ||
| 122 | case "Store": | ||
| 123 | store = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 124 | break; | ||
| 125 | case "Thumbprint": | ||
| 126 | thumbprint = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 127 | break; | ||
| 128 | default: | ||
| 129 | this.ParseHelper.UnexpectedAttribute(node, attrib); | ||
| 130 | break; | ||
| 131 | } | ||
| 132 | } | ||
| 133 | else | ||
| 134 | { | ||
| 135 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); | ||
| 136 | } | ||
| 137 | } | ||
| 138 | |||
| 139 | // Need the element ID for child element processing, so generate now if not authored. | ||
| 140 | if (null == id) | ||
| 141 | { | ||
| 142 | id = this.ParseHelper.CreateIdentifier("ssl", componentId, host, port); | ||
| 143 | } | ||
| 144 | |||
| 145 | // Required attributes. | ||
| 146 | if (null == host) | ||
| 147 | { | ||
| 148 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Host")); | ||
| 149 | } | ||
| 150 | |||
| 151 | if (null == port) | ||
| 152 | { | ||
| 153 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Port")); | ||
| 154 | } | ||
| 155 | |||
| 156 | if (null == thumbprint) | ||
| 157 | { | ||
| 158 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Thumbprint")); | ||
| 159 | } | ||
| 160 | |||
| 161 | // Parse unknown children. | ||
| 162 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); | ||
| 163 | |||
| 164 | if (!this.Messaging.EncounteredError) | ||
| 165 | { | ||
| 166 | section.AddSymbol(new WixHttpSniSslCertSymbol(sourceLineNumbers, id) | ||
| 167 | { | ||
| 168 | Host = host, | ||
| 169 | Port = port, | ||
| 170 | Thumbprint = thumbprint, | ||
| 171 | AppId = appId, | ||
| 172 | Store = store, | ||
| 173 | HandleExisting = handleExisting, | ||
| 174 | ComponentRef = componentId, | ||
| 175 | }); | ||
| 176 | |||
| 177 | this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4SchedHttpSniSslCertsInstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); | ||
| 178 | this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4SchedHttpSniSslCertsUninstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 182 | /// <summary> | ||
| 66 | /// Parses a UrlReservation element. | 183 | /// Parses a UrlReservation element. |
| 67 | /// </summary> | 184 | /// </summary> |
| 68 | /// <param name="node">The element to parse.</param> | 185 | /// <param name="node">The element to parse.</param> |
