Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
MeterSphere
Commits
4863ed06
Commit
4863ed06
authored
3 years ago
by
CaptainB
Committed by
刘瑞斌
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
fix: 校验url时忽略ssl
parent
d73ee56f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
backend/src/main/java/io/metersphere/commons/utils/UrlTestUtils.java
+7
-0
.../main/java/io/metersphere/commons/utils/UrlTestUtils.java
with
7 additions
and
0 deletions
+7
-0
backend/src/main/java/io/metersphere/commons/utils/UrlTestUtils.java
+
7
-
0
View file @
4863ed06
package
io.metersphere.commons.utils
;
import
io.metersphere.ldap.service.CustomSSLSocketFactory
;
import
javax.net.ssl.HttpsURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
...
...
@@ -9,6 +12,10 @@ public class UrlTestUtils {
try
{
URL
urlObj
=
new
URL
(
address
);
HttpURLConnection
oc
=
(
HttpURLConnection
)
urlObj
.
openConnection
();
if
(
oc
instanceof
HttpsURLConnection
)
{
((
HttpsURLConnection
)
oc
).
setSSLSocketFactory
(
new
CustomSSLSocketFactory
());
((
HttpsURLConnection
)
oc
).
setHostnameVerifier
((
hostname
,
session
)
->
true
);
}
oc
.
setUseCaches
(
false
);
oc
.
setConnectTimeout
(
timeOutMillSeconds
);
// 设置超时时间
int
status
=
oc
.
getResponseCode
();
// 请求状态
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment