Skip to content

Commit 0a8d498

Browse files
committed
manual unroll for binary compatibility
1 parent 3472b5e commit 0a8d498

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

zio-http/shared/src/main/scala/zio/http/SSLConfig.scala

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,35 @@ final case class SSLConfig(
3838
provider: Provider,
3939
clientAuth: Option[ClientAuth] = None,
4040
includeClientCert: Boolean = false,
41-
@unroll
4241
protocols: Seq[String] = Seq("TLSv1.3", "TLSv1.2"),
43-
)
42+
) {
43+
// @unroll annotation does not work here, doing manual unroll for binary compatibility
44+
45+
def this(
46+
behaviour: HttpBehaviour,
47+
data: Data,
48+
provider: Provider,
49+
clientAuth: Option[ClientAuth],
50+
includeClientCert: Boolean,
51+
) = this(behaviour, data, provider, clientAuth, includeClientCert, Seq("TLSv1.3", "TLSv1.2"))
52+
53+
def copy(
54+
behaviour: HttpBehaviour = this.behaviour,
55+
data: Data = this.data,
56+
provider: Provider = this.provider,
57+
clientAuth: Option[ClientAuth] = this.clientAuth,
58+
includeClientCert: Boolean = this.includeClientCert,
59+
protocols: Seq[String] = this.protocols,
60+
): SSLConfig = SSLConfig(behaviour, data, provider, clientAuth, includeClientCert, protocols)
61+
62+
def copy(
63+
behaviour: HttpBehaviour,
64+
data: Data,
65+
provider: Provider,
66+
clientAuth: Option[ClientAuth],
67+
includeClientCert: Boolean,
68+
): SSLConfig = SSLConfig(behaviour, data, provider, clientAuth, includeClientCert, this.protocols)
69+
}
4470

4571
object SSLConfig {
4672

@@ -50,6 +76,14 @@ object SSLConfig {
5076
def apply(data: Data, clientAuth: ClientAuth): SSLConfig =
5177
new SSLConfig(HttpBehaviour.Redirect, data, Provider.JDK, Some(clientAuth))
5278

79+
def apply(
80+
behaviour: HttpBehaviour,
81+
data: Data,
82+
provider: Provider,
83+
clientAuth: Option[ClientAuth],
84+
includeClientCert: Boolean,
85+
): SSLConfig = new SSLConfig(behaviour, data, provider, clientAuth, includeClientCert)
86+
5387
val config: Config[SSLConfig] =
5488
(
5589
HttpBehaviour.config.nested("behaviour") ++

0 commit comments

Comments
 (0)