|
158 | 158 | If `ssl-context` is an options map and it does contain an `:application-protocol-config` key, its
|
159 | 159 | supported protocols are validated to match `desired-http-versions`.
|
160 | 160 |
|
161 |
| - Otherwise, if `ssl-context` is an `io.netty.handler.ssl.SslContext` instance, its supported |
162 |
| - protocols are validated to match `desired-http-versions`." |
| 161 | + Otherwise, if `ssl-context` is an `io.netty.handler.ssl.SslContext` instance, its ALPN config's |
| 162 | + protocols are validated to match `desired-http-versions`. If it doesn't have an ALPN config, |
| 163 | + `desired-http-versions` may only contain `:http1`." |
163 | 164 | [ssl-context desired-http-versions]
|
164 | 165 | (when-let [unsupported-http-versions (seq (remove supported-http-versions desired-http-versions))]
|
165 | 166 | (throw (ex-info "Unsupported desired HTTP versions"
|
|
178 | 179 | nil
|
179 | 180 |
|
180 | 181 | :else
|
181 |
| - (do |
182 |
| - (assert-consistent-alpn-config! |
183 |
| - (some-> ^SslContext ssl-context |
184 |
| - (.applicationProtocolNegotiator) |
185 |
| - (.protocols)) |
186 |
| - desired-http-versions) |
187 |
| - ssl-context))) |
| 182 | + ;; NOTE: `SslContext` always has an `ApplicationProtocolNegotiator`, even if |
| 183 | + ;; `.applicationProtocolConfig` was never invoked in the `SslContextBuilder`. In this case, its |
| 184 | + ;; `.protocols` will be an empty collection, which we thus treat as if no ALPN config is |
| 185 | + ;; present. |
| 186 | + (if-let [protocols (some-> ^SslContext ssl-context |
| 187 | + (.applicationProtocolNegotiator) |
| 188 | + (.protocols) |
| 189 | + (seq))] |
| 190 | + (do |
| 191 | + (assert-consistent-alpn-config! |
| 192 | + protocols |
| 193 | + desired-http-versions) |
| 194 | + ssl-context) |
| 195 | + (if (= [:http1] desired-http-versions) |
| 196 | + ssl-context |
| 197 | + (throw (ex-info "No ALPN supplied, but requested non-HTTP/1 versions that require ALPN." |
| 198 | + {:desired-http-versions desired-http-versions})))))) |
188 | 199 |
|
189 | 200 | (defn validate-http1-pipeline-transform
|
190 | 201 | "Checks that :pipeline-transform is not being used with HTTP/2, since Netty
|
|
0 commit comments