File: no-Conscrypt-support.patch

package info (click to toggle)
httpcomponents-client5 5.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 9,056 kB
  • sloc: java: 91,242; xml: 1,158; sh: 241; makefile: 2
file content (218 lines) | stat: -rw-r--r-- 8,943 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
From: Markus Koschany <apo@debian.org>
Date: Sun, 13 Nov 2022 14:44:12 +0100
Subject: no Conscrypt support

Requires new build dependency

Forwarded: not-needed
---
 ...PoolingAsyncClientConnectionManagerBuilder.java |   9 --
 .../http/ssl/ConscryptClientTlsStrategy.java       | 117 ---------------------
 2 files changed, 126 deletions(-)
 delete mode 100644 httpclient5/src/main/java/org/apache/hc/client5/http/ssl/ConscryptClientTlsStrategy.java

--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManagerBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManagerBuilder.java
@@ -33,7 +33,6 @@
 import org.apache.hc.client5.http.config.ConnectionConfig;
 import org.apache.hc.client5.http.config.TlsConfig;
 import org.apache.hc.client5.http.nio.AsyncClientConnectionOperator;
-import org.apache.hc.client5.http.ssl.ConscryptClientTlsStrategy;
 import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy;
 import org.apache.hc.core5.annotation.Experimental;
 import org.apache.hc.core5.annotation.Internal;
@@ -292,19 +291,11 @@
         if (tlsStrategy != null) {
             tlsStrategyCopy = tlsStrategy;
         } else {
-            if (ReflectionUtils.determineJRELevel() <= 8 && ConscryptClientTlsStrategy.isSupported()) {
-                if (systemProperties) {
-                    tlsStrategyCopy = ConscryptClientTlsStrategy.getSystemDefault();
-                } else {
-                    tlsStrategyCopy = ConscryptClientTlsStrategy.getDefault();
-                }
-            } else {
                 if (systemProperties) {
                     tlsStrategyCopy = DefaultClientTlsStrategy.createSystemDefault();
                 } else {
                     tlsStrategyCopy = DefaultClientTlsStrategy.createDefault();
                 }
-            }
         }
         final PoolingAsyncClientConnectionManager poolingmgr = new PoolingAsyncClientConnectionManager(
                 createConnectionOperator(tlsStrategyCopy, schemePortResolver, dnsResolver),
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/ConscryptClientTlsStrategy.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.client5.http.ssl;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLEngine;
-import javax.net.ssl.SSLParameters;
-
-import org.apache.hc.core5.annotation.Contract;
-import org.apache.hc.core5.annotation.ThreadingBehavior;
-import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
-import org.apache.hc.core5.reactor.ssl.SSLBufferMode;
-import org.apache.hc.core5.reactor.ssl.TlsDetails;
-import org.apache.hc.core5.ssl.SSLContexts;
-import org.conscrypt.Conscrypt;
-
-/**
- * TLS upgrade strategy for non-blocking client connections using Conscrypt TLS library.
- *
- * @since 5.0
- */
-@Contract(threading = ThreadingBehavior.STATELESS)
-public class ConscryptClientTlsStrategy extends AbstractClientTlsStrategy {
-
-    public static TlsStrategy getDefault() {
-        return new ConscryptClientTlsStrategy(
-                SSLContexts.createDefault(),
-                HostnameVerificationPolicy.BUILTIN,
-                null);
-    }
-
-    public static TlsStrategy getSystemDefault() {
-        return new ConscryptClientTlsStrategy(
-                SSLContexts.createSystemDefault(),
-                HttpsSupport.getSystemProtocols(),
-                HttpsSupport.getSystemCipherSuits(),
-                SSLBufferMode.STATIC,
-                HostnameVerificationPolicy.BUILTIN,
-                null);
-    }
-
-    public ConscryptClientTlsStrategy(
-            final SSLContext sslContext,
-            final String[] supportedProtocols,
-            final String[] supportedCipherSuites,
-            final SSLBufferMode sslBufferManagement,
-            final HostnameVerifier hostnameVerifier) {
-        this(sslContext, supportedProtocols, supportedCipherSuites, sslBufferManagement, HostnameVerificationPolicy.CLIENT, hostnameVerifier);
-    }
-
-    /**
-     * @since 5.4
-     */
-    public ConscryptClientTlsStrategy(
-            final SSLContext sslContext,
-            final String[] supportedProtocols,
-            final String[] supportedCipherSuites,
-            final SSLBufferMode sslBufferManagement,
-            final HostnameVerificationPolicy hostnameVerificationPolicy,
-            final HostnameVerifier hostnameVerifier) {
-        super(sslContext, supportedProtocols, supportedCipherSuites, sslBufferManagement, hostnameVerificationPolicy, hostnameVerifier);
-    }
-
-    public ConscryptClientTlsStrategy(
-            final SSLContext sslContext,
-            final HostnameVerifier hostnameVerifier) {
-        this(sslContext, null, null, SSLBufferMode.STATIC, hostnameVerifier);
-    }
-
-    /**
-     * @since 5.4
-     */
-    public ConscryptClientTlsStrategy(
-            final SSLContext sslContext,
-            final HostnameVerificationPolicy hostnameVerificationPolicy,
-            final HostnameVerifier hostnameVerifier) {
-        this(sslContext, null, null, SSLBufferMode.STATIC, hostnameVerificationPolicy, hostnameVerifier);
-    }
-
-    public ConscryptClientTlsStrategy(final SSLContext sslContext) {
-        this(sslContext, null);
-    }
-
-    @Override
-    void applyParameters(final SSLEngine sslEngine, final SSLParameters sslParameters, final String[] appProtocols) {
-        if (Conscrypt.isConscrypt(sslEngine)) {
-            sslEngine.setSSLParameters(sslParameters);
-            Conscrypt.setApplicationProtocols(sslEngine, appProtocols);
-        } else {
-            sslParameters.setApplicationProtocols(appProtocols);
-            sslEngine.setSSLParameters(sslParameters);
-        }
-    }
-
-    @Override
-    TlsDetails createTlsDetails(final SSLEngine sslEngine) {
-        if (Conscrypt.isConscrypt(sslEngine)) {
-            return new TlsDetails(sslEngine.getSession(), Conscrypt.getApplicationProtocol(sslEngine));
-        }
-        return null;
-    }
-
-    public static boolean isSupported() {
-        try {
-            final Class<?> clazz = Class.forName("org.conscrypt.Conscrypt");
-            final Method method = clazz.getMethod("isAvailable");
-            return ((Boolean) method.invoke(null)).booleanValue();
-        } catch (final ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
-            return false;
-        }
-    }
-
-}
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/TunnelRefusedException.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/TunnelRefusedException.java
@@ -31,7 +31,6 @@
 import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.message.BasicHttpResponse;
 import org.apache.hc.core5.http.message.StatusLine;
-import org.conscrypt.Internal;
 
 /**
  * Signals that the tunnel request was rejected by the proxy host.
@@ -56,7 +55,6 @@
         this.response = new BasicHttpResponse(500);
     }
 
-    @Internal
     public TunnelRefusedException(final HttpResponse response) {
         super("CONNECT refused by proxy: " + new StatusLine(response));
         this.response = response;
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/SaslPrep.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/SaslPrep.java
@@ -36,9 +36,7 @@
 import java.util.TreeMap;
 
 import org.apache.hc.client5.http.impl.ScramException;
-import org.conscrypt.Internal;
 
-@Internal
 class SaslPrep {
 
     public static final SaslPrep INSTANCE = new SaslPrep();