Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/RockyLOMO/rxlib
Browse files Browse the repository at this point in the history
  • Loading branch information
youfanx committed Jun 25, 2024
2 parents b51981b + 6dc0b04 commit b6ff95e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion rxlib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<byte-buddy.version>1.14.16</byte-buddy.version>
<zip4j.version>2.11.3</zip4j.version>
<h2.version>2.2.224</h2.version>
<netty.version>4.1.110.Final</netty.version>
<netty.version>4.1.111.Final</netty.version>
<bcprov.version>1.78.1</bcprov.version>
<okhttp.version>4.12.0</okhttp.version>
<sshd.version>2.12.1</sshd.version>
Expand Down
14 changes: 4 additions & 10 deletions rxlib/src/main/java/org/rx/net/http/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,8 @@ static OkHttpClient createClient(long connectTimeoutMillis, long readWriteTimeou
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, new TrustManager[]{TRUST_MANAGER}, new SecureRandom());
Authenticator authenticator = proxy instanceof AuthenticProxy ? ((AuthenticProxy) proxy).getAuthenticator() : Authenticator.NONE;
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.sslSocketFactory(sslContext.getSocketFactory(), TRUST_MANAGER).hostnameVerifier((s, sslSession) -> true)
.connectionPool(POOL).retryOnConnectionFailure(true) //unexpected end of stream
.connectTimeout(connectTimeoutMillis, TimeUnit.MILLISECONDS)
.readTimeout(readWriteTimeoutMillis, TimeUnit.MILLISECONDS).writeTimeout(readWriteTimeoutMillis, TimeUnit.MILLISECONDS)
.proxy(proxy).proxyAuthenticator(authenticator);
OkHttpClient.Builder builder = new OkHttpClient.Builder().sslSocketFactory(sslContext.getSocketFactory(), TRUST_MANAGER).hostnameVerifier((s, sslSession) -> true).connectionPool(POOL).retryOnConnectionFailure(true) //unexpected end of stream
.connectTimeout(connectTimeoutMillis, TimeUnit.MILLISECONDS).readTimeout(readWriteTimeoutMillis, TimeUnit.MILLISECONDS).writeTimeout(readWriteTimeoutMillis, TimeUnit.MILLISECONDS).proxy(proxy).proxyAuthenticator(authenticator);
if (enableCookie) {
builder.cookieJar(COOKIES);
}
Expand All @@ -404,7 +400,7 @@ static OkHttpClient createClient(long connectTimeoutMillis, long readWriteTimeou
ResponseContent resContent;

public HttpClient withFeatures(boolean enableCookie, boolean enableLog) {
return withFeatures(enableCookie, enableLog);
return withFeatures(enableCookie, enableLog, true);
}

public synchronized HttpClient withFeatures(boolean enableCookie, boolean enableLog, boolean cachingStream) {
Expand Down Expand Up @@ -491,9 +487,7 @@ Request.Builder createRequest(String url) {

@SneakyThrows
synchronized ResponseContent invoke(String url, HttpMethod method, RequestContent content) {
ProceedEventArgs args = new ProceedEventArgs(this.getClass(),
new Object[]{method.toString(), content instanceof JsonContent ? ((JsonContent) content).json : content.toString()},
false);
ProceedEventArgs args = new ProceedEventArgs(this.getClass(), new Object[]{method.toString(), content instanceof JsonContent ? ((JsonContent) content).json : content.toString()}, false);
try {
Request.Builder request = createRequest(url);
RequestBody requestBody = content.toBody();
Expand Down

0 comments on commit b6ff95e

Please sign in to comment.