File tree Expand file tree Collapse file tree
main/java/com/laker/postman
test/java/com/laker/postman/service/setting Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public class PreparedRequest {
2424 public boolean isMultipart ;
2525 public boolean followRedirects = true ; // 默认自动重定向
2626 public boolean cookieJarEnabled = true ; // 默认启用 Cookie Jar
27- public boolean sslVerificationEnabled = true ; // 默认启用 SSL 校验
27+ public boolean sslVerificationEnabled = false ; // 默认禁用 SSL 校验
2828 public String httpVersion = HttpRequestItem .HTTP_VERSION_AUTO ; // HTTP 协议偏好
2929 public int requestTimeoutMs = 0 ; // 0 表示不超时
3030
Original file line number Diff line number Diff line change @@ -405,7 +405,7 @@ private RequestHistoryItem convertFromJson(JSONObject jsonItem) {
405405 request .followRedirects = requestJson .getBool ("followRedirects" , true );
406406 request .isMultipart = requestJson .getBool ("isMultipart" , false );
407407 request .cookieJarEnabled = requestJson .getBool ("cookieJarEnabled" , true );
408- request .sslVerificationEnabled = requestJson .getBool ("sslVerificationEnabled" , true );
408+ request .sslVerificationEnabled = requestJson .getBool ("sslVerificationEnabled" , false );
409409 request .httpVersion = requestJson .getStr ("httpVersion" );
410410 request .requestTimeoutMs = requestJson .getInt ("requestTimeoutMs" , 0 );
411411 request .collectBasicInfo = requestJson .getBool ("collectBasicInfo" , true );
Original file line number Diff line number Diff line change @@ -925,7 +925,7 @@ public static boolean isProxySslVerificationDisabled() {
925925 if (val != null ) {
926926 return Boolean .parseBoolean (val );
927927 }
928- return false ; // 默认启用 SSL 验证
928+ return true ; // 默认禁用代理 SSL 验证,避免代理环境阻断请求
929929 }
930930
931931 public static void setProxySslVerificationDisabled (boolean disabled ) {
Original file line number Diff line number Diff line change 22
33import cn .hutool .json .JSONUtil ;
44import com .laker .postman .model .TrustedCertificateEntry ;
5+ import com .laker .postman .model .PreparedRequest ;
56import org .testng .annotations .Test ;
67
78import java .lang .reflect .Field ;
89import java .util .List ;
910import java .util .Properties ;
1011
1112import static org .testng .Assert .assertEquals ;
13+ import static org .testng .Assert .assertFalse ;
1214import static org .testng .Assert .assertTrue ;
1315
1416public class SettingManagerTrustedCertificateTest {
@@ -64,6 +66,30 @@ public void shouldPersistTrustedCertificateEntriesAsJsonList() throws Exception
6466 }
6567 }
6668
69+ @ Test
70+ public void shouldDisableRequestAndProxySslVerificationByDefaultWhenUnset () throws Exception {
71+ Properties props = getSettingsProperties ();
72+ Properties backup = new Properties ();
73+ backup .putAll (props );
74+
75+ try {
76+ props .clear ();
77+
78+ assertTrue (SettingManager .isRequestSslVerificationDisabled ());
79+ assertTrue (SettingManager .isProxySslVerificationDisabled ());
80+ } finally {
81+ props .clear ();
82+ props .putAll (backup );
83+ }
84+ }
85+
86+ @ Test
87+ public void preparedRequestShouldDefaultToLenientSslVerification () {
88+ PreparedRequest request = new PreparedRequest ();
89+
90+ assertFalse (request .sslVerificationEnabled );
91+ }
92+
6793 private static Properties getSettingsProperties () throws Exception {
6894 Field propsField = SettingManager .class .getDeclaredField ("props" );
6995 propsField .setAccessible (true );
You can’t perform that action at this time.
0 commit comments