Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit fa2037f

Browse files
committed
fix connection and response timeout for the apache http client
1 parent 6c85b61 commit fa2037f

File tree

5 files changed

+34
-22
lines changed

5 files changed

+34
-22
lines changed

.idea/workspace.xml

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ will need to navigate to `C:\Program Files\ploiu-file-server` and manually add `
1616
for the same reason.
1717

1818
## Other
19-
parts of the application icon were created with images on the public domain. I found it [here](https://www.svgrepo.com/svg/153295/server)
19+
20+
parts of the application icon were created with images on the public domain. I found
21+
it [here](https://www.svgrepo.com/svg/153295/server)

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ jlink {
103103
skipInstaller = false
104104
if (Os.isFamily(Os.FAMILY_UNIX)) {
105105
installerType = 'deb'
106-
imageOptions = ['--icon', 'src/main/resources/assets/img/icon.png']
106+
imageOptions = ['--icon', 'src/main/resources/assets/img/icon.png']
107107
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
108108
installerType = 'exe'
109-
imageOptions = ['--icon', 'src/main/resources/assets/img/icon.ico']
109+
imageOptions = ['--icon', 'src/main/resources/assets/img/icon.ico']
110110
}
111111
installerOutputDir = file("$buildDir/file-server-installer")
112112
}

src/main/java/ploiu/module/HttpModule.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import io.reactivex.rxjava3.schedulers.Schedulers;
99
import okhttp3.OkHttpClient;
1010
import org.apache.hc.client5.http.classic.HttpClient;
11+
import org.apache.hc.client5.http.config.RequestConfig;
1112
import org.apache.hc.client5.http.impl.classic.HttpClients;
1213
import org.apache.hc.core5.http.message.BasicHeader;
1314
import ploiu.client.TagClient;
@@ -18,6 +19,7 @@
1819
import retrofit2.converter.jackson.JacksonConverterFactory;
1920

2021
import java.util.List;
22+
import java.util.concurrent.TimeUnit;
2123

2224
import static org.apache.hc.core5.http.ContentType.APPLICATION_JSON;
2325
import static org.apache.hc.core5.http.HttpHeaders.ACCEPT;
@@ -29,8 +31,14 @@ public class HttpModule extends AbstractModule {
2931
@Provides
3032
@Deprecated
3133
HttpClient apacheHttpClient(AuthenticationConfig authConfig) {
34+
var requestConfig = RequestConfig.custom()
35+
// "a timeout value of zero is interpreted as infinite"....yeah it's not
36+
.setConnectionRequestTimeout(100, TimeUnit.DAYS)
37+
.setResponseTimeout(100, TimeUnit.DAYS)
38+
.build();
3239
return HttpClients
3340
.custom()
41+
.setDefaultRequestConfig(requestConfig)
3442
.setDefaultHeaders(List.of(
3543
new BasicHeader(ACCEPT, APPLICATION_JSON),
3644
new BasicHeader(AUTHORIZATION, authConfig.basicAuth())

src/main/resources/assets/img/server.svg

Lines changed: 13 additions & 12 deletions
Loading

0 commit comments

Comments
 (0)