Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/plugin/protocol-okhttp/ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
</publications>

<dependencies>
<dependency org="com.squareup.okhttp3" name="okhttp" rev="4.9.3"/>
<dependency org="com.squareup.okhttp3" name="okhttp-brotli" rev="4.9.3"/>
<dependency org="com.squareup.okhttp3" name="okhttp" rev="5.3.2"/>
<dependency org="com.squareup.okhttp3" name="okhttp-brotli" rev="5.3.2"/>
<dependency org="com.squareup.okhttp3" name="okhttp-zstd" rev="5.3.2"/>
</dependencies>

</ivy-module>
16 changes: 9 additions & 7 deletions src/plugin/protocol-okhttp/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@
<!-- dependencies of OkHttp -->
<library name="annotations-13.0.jar"/>
<library name="dec-0.1.2.jar"/>
<library name="kotlin-stdlib-1.4.10.jar"/>
<library name="kotlin-stdlib-common-1.4.10.jar"/>
<library name="kotlin-stdlib-jdk7-1.4.10.jar"/>
<library name="kotlin-stdlib-jdk8-1.4.10.jar"/>
<library name="okhttp-4.9.3.jar"/>
<library name="okhttp-brotli-4.9.3.jar"/>
<library name="okio-2.8.0.jar"/>
<library name="kotlin-stdlib-2.2.21.jar"/>
<library name="okhttp-5.3.2.jar"/>
<library name="okhttp-brotli-5.3.2.jar"/>
<library name="okhttp-jvm-5.3.2.jar"/>
<library name="okhttp-zstd-5.3.2.jar"/>
<library name="okio-3.16.4.jar"/>
<library name="okio-jvm-3.16.4.jar"/>
<library name="zstd-kmp-jvm-0.4.0.jar"/>
<library name="zstd-kmp-okio-jvm-0.4.0.jar"/>
<!-- end of dependencies of OkHttp -->
</runtime>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,19 @@
import org.slf4j.LoggerFactory;

import okhttp3.Authenticator;
import okhttp3.CompressionInterceptor;
import okhttp3.Connection;
import okhttp3.ConnectionPool;
import okhttp3.Gzip;
import okhttp3.Handshake;
import okhttp3.Headers;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.brotli.BrotliInterceptor;
import okhttp3.brotli.Brotli;
import okhttp3.zstd.Zstd;


public class OkHttp extends HttpBase {

Expand Down Expand Up @@ -156,13 +160,11 @@ public boolean verify(String hostname, SSLSession session) {
String proxyUsername = conf.get("http.proxy.username");
if (proxyUsername == null) {
ProxySelector selector = new ProxySelector() {
@SuppressWarnings("serial")
private final List<Proxy> noProxyList = new ArrayList<Proxy>() {
{
add(Proxy.NO_PROXY);
}
};
@SuppressWarnings("serial")
private final List<Proxy> proxyList = new ArrayList<Proxy>() {
{
add(proxy);
Expand Down Expand Up @@ -224,8 +226,9 @@ public Request authenticate(okhttp3.Route route,
builder.addNetworkInterceptor(new HTTPHeadersInterceptor());
}

// enable support for Brotli compression (Content-Encoding)
builder.addInterceptor(BrotliInterceptor.INSTANCE);
// enable support for Zstd, Brotli, Gzip Content-Encoding
builder.addInterceptor(new CompressionInterceptor(Zstd.INSTANCE,
Brotli.INSTANCE, Gzip.INSTANCE));

// instantiate connection pool(s), cf.
// https://square.github.io/okhttp/3.x/okhttp/okhttp3/ConnectionPool.html
Expand Down