[#1536] Enhancement: Add shortcut for --verify=no.

This commit is contained in:
HackTheOxidation 2023-11-25 18:02:24 +01:00
parent 9e8e3691c8
commit 51606bf276
2 changed files with 16 additions and 0 deletions

View File

@ -811,6 +811,7 @@ ssl = options.add_group('SSL')
ssl.add_argument(
'--verify',
dest='verify',
default='yes',
short_help='If "no", skip SSL verification. If a file path, use it as a CA bundle.',
help="""
@ -820,6 +821,16 @@ ssl.add_argument(
variable instead.)
""",
)
ssl.add_argument(
'-k',
dest='verify',
default='no',
short_help='Shortcut for "--verify=no" skipping SSL verification',
help="""
Shortcut for "--verify=no" which skips verification of the host's
SSL certificate. See the '--verify' flag help for further information.
""",
)
ssl.add_argument(
'--ssl',
dest='ssl_version',

View File

@ -113,6 +113,11 @@ class TestServerCert:
r = http(httpbin_secure.url + '/get', '--verify=no')
assert HTTP_OK in r
def test_verify_no_shortcut_OK(self, httpbin_secure):
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
r = http(httpbin_secure.url + '/get', '-k')
assert HTTP_OK in r
@pytest.mark.parametrize('verify_value', ['false', 'fALse'])
def test_verify_false_OK(self, httpbin_secure, verify_value):
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)