Skip to content

Commit

Permalink
添加TLSv1.3支持
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayaoO3O committed Nov 5, 2022
1 parent bdcdc6e commit c5770f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public WebClient getWebClient() {
.setType(ProxyType.HTTP));
}
webClientOptions.setUserAgentEnabled(true);
webClientOptions.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 Hutool");
webClientOptions.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.26");
webClientOptions.setProtocolVersion(HttpVersion.HTTP_1_1);
webClientOptions.addEnabledSecureTransportProtocol("TLSv1.3");
webClientOptions.setKeepAlive(true);
webClientOptions.setFollowRedirects(true);
webClientOptions.setVerifyHost(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public BufferedImage reverseImage(BufferedImage bufferedImage, int chapterId, in
public Uni<HttpResponse<Buffer>> post(String url) {
var request = webClient.getAbs(url)
.port(443)
.putHeader("Accept", "text/html,application/xhtml+xml,application/xml")
.putHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9")
.putHeader("Accept-Encoding", "deflate")
.putHeader("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6")
.putHeader("Refer", url)
Expand All @@ -308,7 +308,7 @@ public Uni<HttpResponse<Buffer>> post(String url) {
.putHeader("upgrade-insecure-requests", " 1")
.putHeader("pragma", " no-cache");
//cookie.ifPresent(cook -> request.putHeader("cookie", cook));
return request.send()
return request.send().log()
.chain(response -> this.checkResponseStatus(url, response))
.onFailure()
.retry()
Expand Down

0 comments on commit c5770f2

Please sign in to comment.