diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e536fe9..d676b17 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -18,7 +18,7 @@ mergeTool = "1.1.7" checkerQual = { module = "org.checkerframework:checker-qual", version.ref = "checker" } # downloader-apache-http -apache-httpClient5 = { module = "org.apache.httpcomponents.client5:httpclient5", version = "5.1.3" } +apache-httpClient5 = { module = "org.apache.httpcomponents.client5:httpclient5", version = "5.2.1" } # gradle-plugin accessWidener = { module = "net.fabricmc:access-widener", version.ref = "accessWidener" } diff --git a/subprojects/downloader-apache-http/build.gradle.kts b/subprojects/downloader-apache-http/build.gradle.kts index 10b6102..1bcc604 100644 --- a/subprojects/downloader-apache-http/build.gradle.kts +++ b/subprojects/downloader-apache-http/build.gradle.kts @@ -8,9 +8,3 @@ dependencies { api(project(":vanillagradle-resolver-core")) implementation(libs.apache.httpClient5) } - -sourceSets { - main { - multirelease.alternateVersions(9) - } -} diff --git a/subprojects/downloader-apache-http/src/main/java/org/spongepowered/gradle/vanilla/resolver/apache/ApacheHttpDownloader.java b/subprojects/downloader-apache-http/src/main/java/org/spongepowered/gradle/vanilla/resolver/apache/ApacheHttpDownloader.java index ebb2fc9..3f7994d 100644 --- a/subprojects/downloader-apache-http/src/main/java/org/spongepowered/gradle/vanilla/resolver/apache/ApacheHttpDownloader.java +++ b/subprojects/downloader-apache-http/src/main/java/org/spongepowered/gradle/vanilla/resolver/apache/ApacheHttpDownloader.java @@ -29,17 +29,13 @@ import org.apache.hc.client5.http.async.methods.SimpleRequestProducer; import org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategy; import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; import org.apache.hc.client5.http.impl.async.HttpAsyncClientBuilder; -import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager; -import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManagerBuilder; import org.apache.hc.core5.http.HttpResponse; import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.Message; import org.apache.hc.core5.http.nio.AsyncEntityConsumer; import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityConsumer; import org.apache.hc.core5.http.nio.entity.StringAsyncEntityConsumer; -import org.apache.hc.core5.http.nio.ssl.TlsStrategy; import org.apache.hc.core5.http.nio.support.BasicResponseConsumer; -import org.apache.hc.core5.http2.HttpVersionPolicy; import org.apache.hc.core5.io.CloseMode; import org.apache.hc.core5.reactor.IOReactorConfig; import org.apache.hc.core5.util.TimeValue; @@ -113,16 +109,9 @@ public final class ApacheHttpDownloader implements AutoCloseable, Downloader { .setSoTimeout(Timeout.ofSeconds(5)) .build(); - final TlsStrategy tlsStrategy = TlsStrategyProvider.provide(); - final PoolingAsyncClientConnectionManager cm = PoolingAsyncClientConnectionManagerBuilder.create() - .setTlsStrategy(tlsStrategy) - .build(); - this.client = HttpAsyncClientBuilder.create() .setIOReactorConfig(config) .setUserAgent("vanillagradle-resolver/" + this.getClass().getPackage().getImplementationVersion()) // todo: re-implement - .setVersionPolicy(HttpVersionPolicy.NEGOTIATE) - .setConnectionManager(cm) .setRetryStrategy(new DefaultHttpRequestRetryStrategy(5, TimeValue.ofMilliseconds(500))) .build(); this.shouldClose = true; diff --git a/subprojects/downloader-apache-http/src/main/java/org/spongepowered/gradle/vanilla/resolver/apache/TlsStrategyProvider.java b/subprojects/downloader-apache-http/src/main/java/org/spongepowered/gradle/vanilla/resolver/apache/TlsStrategyProvider.java deleted file mode 100644 index aa7db1f..0000000 --- a/subprojects/downloader-apache-http/src/main/java/org/spongepowered/gradle/vanilla/resolver/apache/TlsStrategyProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of VanillaGradle, licensed under the MIT License (MIT). - * - * Copyright (c) SpongePowered - * Copyright (c) contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package org.spongepowered.gradle.vanilla.resolver.apache; - -import org.apache.hc.client5.http.ssl.ClientTlsStrategyBuilder; -import org.apache.hc.core5.http.nio.ssl.TlsStrategy; - -final class TlsStrategyProvider { - - private TlsStrategyProvider() { - } - - static TlsStrategy provide() { - return ClientTlsStrategyBuilder.create() - .useSystemProperties() - .build(); - } - -} diff --git a/subprojects/downloader-apache-http/src/main/java9/org/spongepowered/gradle/vanilla/resolver/apache/TlsStrategyProvider.java b/subprojects/downloader-apache-http/src/main/java9/org/spongepowered/gradle/vanilla/resolver/apache/TlsStrategyProvider.java deleted file mode 100644 index 40c1945..0000000 --- a/subprojects/downloader-apache-http/src/main/java9/org/spongepowered/gradle/vanilla/resolver/apache/TlsStrategyProvider.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file is part of VanillaGradle, licensed under the MIT License (MIT). - * - * Copyright (c) SpongePowered - * Copyright (c) contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package org.spongepowered.gradle.vanilla.resolver.apache; - -import org.apache.hc.client5.http.ssl.ClientTlsStrategyBuilder; -import org.apache.hc.core5.http.nio.ssl.TlsStrategy; -import org.apache.hc.core5.reactor.ssl.TlsDetails; - -// See main source set -final class TlsStrategyProvider { - - private TlsStrategyProvider() { - } - - static TlsStrategy provide() { - return ClientTlsStrategyBuilder.create() - .useSystemProperties() - .setTlsDetailsFactory(engine -> { - return new TlsDetails(engine.getSession(), engine.getApplicationProtocol()); - }) - .build(); - } - -}