From 411185afbb34cf5970e4b7b6ae819d5bbcd5d623 Mon Sep 17 00:00:00 2001 From: Lincoln Baker Date: Wed, 4 Dec 2024 21:30:07 -0600 Subject: [PATCH] WIP patch httpc:request options (verify_none) Signed-off-by: Lincoln Baker --- test/decision_core_test.erl | 116 +++++++++++++++--------------- test/etag_test.erl | 2 +- test/wm_integration_test_util.erl | 2 +- 3 files changed, 60 insertions(+), 60 deletions(-) diff --git a/test/decision_core_test.erl b/test/decision_core_test.erl index 7cef7e0a..8d182504 100644 --- a/test/decision_core_test.erl +++ b/test/decision_core_test.erl @@ -361,7 +361,7 @@ atom_matches(Atom, RE) when is_atom(Atom) -> %% 503 result via B13B (predicate: service_available) service_unavailable() -> put_setting(service_available, false), - {ok, Result} = httpc:request(head, {url(), []}, [], []), + {ok, Result} = httpc:request(head, {url(), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 503, "Service Unavailable"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B13, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -373,7 +373,7 @@ internal_server_error_o18() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(content_types_provided, [{"text/plain", size_stream_raises_error}]), - {ok, Result} = httpc:request(get, {url("foo"), []}, [], []), + {ok, Result} = httpc:request(get, {url("foo"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 500, "Internal Server Error"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -394,7 +394,7 @@ size_stream_raises_error(ReqData, Context) -> not_implemented_b12() -> put_setting(allowed_methods, ?HTTP_1_0_METHODS), put_setting(known_methods, ?HTTP_1_0_METHODS), - {ok, Result} = httpc:request(delete, {url(), []}, [], []), + {ok, Result} = httpc:request(delete, {url(), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 501, "Not Implemented"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B12, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -404,7 +404,7 @@ not_implemented_b12() -> not_implemented_b6() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(valid_content_headers, false), - {ok, Result} = httpc:request(get, {url(), []}, [], []), + {ok, Result} = httpc:request(get, {url(), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 501, "Not Implemented"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B6, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -415,7 +415,7 @@ uri_too_long_b11() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(uri_too_long, true), TooLong = url("notreallythatlongactually"), - {ok, Result} = httpc:request(get, {TooLong, []}, [], []), + {ok, Result} = httpc:request(get, {TooLong, []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 414, "Request-URI Too Large"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B11, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -425,7 +425,7 @@ uri_too_long_b11() -> unsupported_media_type_b5() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(known_content_type, false), - {ok, Result} = httpc:request(get, {url(), []}, [], []), + {ok, Result} = httpc:request(get, {url(), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 415, "Unsupported Media Type"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B5, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -435,7 +435,7 @@ unsupported_media_type_b5() -> request_entity_too_large_b4() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(valid_entity_length, false), - {ok, Result} = httpc:request(get, {url(), []}, [], []), + {ok, Result} = httpc:request(get, {url(), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 413, "Request Entity Too Large"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B4, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -444,7 +444,7 @@ request_entity_too_large_b4() -> %% 200 from head method allowed head_method_allowed() -> put_setting(allowed_methods, ['GET', 'HEAD']), - {ok, Result} = httpc:request(head, {url("foo"), []}, [], []), + {ok, Result} = httpc:request(head, {url("foo"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 200, "OK"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -453,7 +453,7 @@ head_method_allowed() -> %% 405 from head method not allowed head_method_not_allowed() -> put_setting(allowed_methods, ['GET', 'POST', 'PUT']), - {ok, Result} = httpc:request(head, {url("foo"), []}, [], []), + {ok, Result} = httpc:request(head, {url("foo"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 405, "Method Not Allowed"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B10, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -495,7 +495,7 @@ non_standard_method_200() -> bad_request_b9() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(malformed_request, true), - {ok, Result} = httpc:request(get, {url(), []}, [], []), + {ok, Result} = httpc:request(get, {url(), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 400, "Bad Request"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B9, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -504,7 +504,7 @@ bad_request_b9() -> %% 200 from a get simple_get() -> put_setting(allowed_methods, ['GET']), - {ok, Result} = httpc:request(get, {url("foo"), []}, [], []), + {ok, Result} = httpc:request(get, {url("foo"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 200, "OK"}, _, ?HTML_CONTENT}, Result), ExpectedDecisionTrace = ?PATH_TO_O18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -514,7 +514,7 @@ simple_get() -> not_acceptable_c4() -> put_setting(allowed_methods, ['GET']), Headers = [{"Accept", "video/mp4"}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 406, "Not Acceptable"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_C4, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -527,7 +527,7 @@ not_acceptable_d5_c4() -> put_setting(language_available, false), Headers = [{"Accept", "text/plain"}, {"Accept-Language", "x-pig-latin"}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 406, "Not Acceptable"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_D5_VIA_C4, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -539,7 +539,7 @@ not_acceptable_d5_c3() -> put_setting(content_types_provided, [{"text/plain", to_html}]), put_setting(language_available, false), Headers = [{"Accept-Language", "x-pig-latin"}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 406, "Not Acceptable"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_D5_VIA_C3, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -552,7 +552,7 @@ not_acceptable_e6_d5_c3() -> put_setting(charsets_provided, [{"utf-8", fun identity/1}]), Headers = [{"Accept-Language", "en-US"}, {"Accept-Charset", "ISO-8859-1"}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 406, "Not Acceptable"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_E6_VIA_D5_C3, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -569,7 +569,7 @@ not_acceptable_f7_e6_d5_c4() -> {"Accept-Language", "en-US"}, {"Accept-Charset", "utf-8"}, {"Accept-Encoding", "gzip"}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 406, "Not Acceptable"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_F7_VIA_E6_D5_C4, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -580,7 +580,7 @@ precond_fail_no_resource() -> put_setting(allowed_methods, ['GET']), put_setting(resource_exists, false), Headers = [{"If-Match", "*"}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 412, "Precondition Failed"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_H7_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -591,7 +591,7 @@ precond_fail_g11() -> put_setting(allowed_methods, ['GET']), put_setting(generate_etag, "v2"), Headers = [{"If-Match", "\"v0\", \"v1\""}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 412, "Precondition Failed"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_G11_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -605,7 +605,7 @@ precond_fail_h12() -> ResErlDate = httpd_util:convert_request_date(FivePM), put_setting(last_modified, ResErlDate), Headers = [{"If-Unmodified-Since", TenAM}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 412, "Precondition Failed"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_H12_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -616,7 +616,7 @@ precond_fail_j18() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), Headers = [{"If-None-Match", "*"}], PutRequest = {url(), Headers, "text/plain", "foo"}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 412, "Precondition Failed"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_J18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -630,7 +630,7 @@ precond_fail_j18_via_k13() -> {"If-None-Match", "\"v1\""}, {"If-Unmodified-Since", "{{INVALID DATE}}"}], PutRequest = {url(), Headers, "text/plain", "foo"}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 412, "Precondition Failed"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_J18_NO_ACPTHEAD_2, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -647,7 +647,7 @@ precond_fail_j18_via_h12() -> {"If-None-Match", "*"}, {"If-Unmodified-Since", FivePM}], PutRequest = {url(), Headers, "text/plain", "foo"}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 412, "Precondition Failed"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_J18_NO_ACPTHEAD_3, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -662,7 +662,7 @@ content_md5_valid_b9a() -> MD5Sum = base64:encode_to_string(md5(Body)), Headers = [{"Content-MD5", MD5Sum}], PutRequest = {url("new"), Headers, ContentType, Body}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 204, "No Content"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O20_VIA_P11_VIA_O14_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -679,7 +679,7 @@ content_md5_valid_b9a_validated() -> MD5Sum = base64:encode_to_string(md5(Body)), Headers = [{"Content-MD5", MD5Sum}], PutRequest = {url("new"), Headers, ContentType, Body}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 204, "No Content"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O20_VIA_P11_VIA_O14_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -693,7 +693,7 @@ content_md5_invalid_b9a() -> InvalidMD5Sum = base64:encode_to_string("this is invalid for foo"), Headers = [{"Content-MD5", InvalidMD5Sum}], PutRequest = {url(), Headers, ContentType, Body}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 400, "Bad Request"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B9, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -708,7 +708,7 @@ content_md5_custom_inval_b9a() -> InvalidMD5Sum = base64:encode_to_string("this is invalid for foo"), Headers = [{"Content-MD5", InvalidMD5Sum}], PutRequest = {url(), Headers, ContentType, Body}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 400, "Bad Request"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B9, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -718,7 +718,7 @@ content_md5_custom_inval_b9a() -> authorized_b8() -> put_setting(is_authorized, "Basic"), put_setting(allowed_methods, ['GET']), - {ok, Result} = httpc:request(get, {url("foo"), []}, [], []), + {ok, Result} = httpc:request(get, {url("foo"), []}, [{ssl, [{verify, verify_none}]}], []), {{Protocol, Code, Status}, Headers, _} = Result, ?assertEqual("HTTP/1.1", Protocol), ?assertEqual(401, Code), @@ -732,7 +732,7 @@ authorized_b8() -> forbidden_b7() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(forbidden, true), - {ok, Result} = httpc:request(get, {url("forbiddenfoo"), []}, [], []), + {ok, Result} = httpc:request(get, {url("forbiddenfoo"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 403, "Forbidden"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B7, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -741,7 +741,7 @@ forbidden_b7() -> %% 200 result, via OPTIONS options_b3() -> put_setting(allowed_methods, ['GET', 'HEAD', 'PUT', 'OPTIONS']), - {ok, Result} = httpc:request(options, {url(), []}, [], []), + {ok, Result} = httpc:request(options, {url(), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 200, "OK"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_B3, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -754,7 +754,7 @@ variances_o18() -> {"iso-8859-5", fun identity/1}, {"unicode-1-1", fun identity/1}], put_setting(charsets_provided, Charsets), - {ok, Result} = httpc:request(get, {url("foo"), []}, [], []), + {ok, Result} = httpc:request(get, {url("foo"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 200, "OK"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -769,7 +769,7 @@ variances_o18_2() -> Charsets = [{"utf-8", fun identity/1}], put_setting(charsets_provided, Charsets), put_setting(encodings_provided, use_identity_or_gzip), - {ok, Result} = httpc:request(get, {url("foo"), []}, [], []), + {ok, Result} = httpc:request(get, {url("foo"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 200, "OK"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -781,7 +781,7 @@ ok_o18b() -> put_setting(generate_etag, "v1"), put_setting(last_modified, ?FIRST_DAY_OF_LAST_YEAR), put_setting(expires, ?FIRST_DAY_OF_NEXT_YEAR), - {ok, Result} = httpc:request(get, {url("foo"), []}, [], []), + {ok, Result} = httpc:request(get, {url("foo"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 200, "OK"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -795,7 +795,7 @@ multiple_choices_o18() -> {"iso-8859-5", fun identity/1}, {"unicode-1-1", fun identity/1}], put_setting(charsets_provided, Charsets), - {ok, Result} = httpc:request(get, {url("foo"), []}, [], []), + {ok, Result} = httpc:request(get, {url("foo"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 300, "Multiple Choices"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -807,7 +807,7 @@ moved_permanently_i4() -> put_setting(resource_exists, false), put_setting(moved_permanently, {true, url("new")}), PutRequest = {url("old"), [], "text/plain", "foo"}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 301, "Moved Permanently"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_I4_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -846,7 +846,7 @@ moved_temporarily_l5() -> not_modified_j18() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), Headers = [{"If-None-Match", "*"}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 304, "Not Modified"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_J18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -859,7 +859,7 @@ not_modified_j18_via_k13() -> Headers = [{"If-Match", "\"v1\""}, {"If-None-Match", "\"v1\""}, {"If-Unmodified-Since", "{{INVALID DATE}}"}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 304, "Not Modified"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_J18_NO_ACPTHEAD_2, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -875,7 +875,7 @@ not_modified_j18_via_h12() -> Headers = [{"If-Match", "*"}, {"If-None-Match", "*"}, {"If-Unmodified-Since", FivePM}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 304, "Not Modified"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_J18_NO_ACPTHEAD_3, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -888,7 +888,7 @@ not_modified_l17() -> put_setting(expires, ?FIRST_DAY_OF_NEXT_YEAR), RFC1123LastYear = httpd_util:rfc1123_date(?FIRST_DAY_OF_LAST_YEAR), Headers = [{"If-Modified-Since", RFC1123LastYear}], - {ok, Result} = httpc:request(get, {url(), Headers}, [], []), + {ok, Result} = httpc:request(get, {url(), Headers}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 304, "Not Modified"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_L17_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -903,7 +903,7 @@ see_other_n11() -> put_setting(content_types_accepted, [{ContentType, to_html}]), put_setting(process_post, {set_resp_redirect, ?RESOURCE_PATH ++ "/new1"}), PostRequest = {url("post"), [], ContentType, "foo"}, - {ok, Result} = httpc:request(post, PostRequest, [{autoredirect,false}], []), + {ok, Result} = httpc:request(post, PostRequest, [{autoredirect,false}, {ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 303, "See Other"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_N11_VIA_M7_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -918,7 +918,7 @@ internal_server_error_n11() -> put_setting(content_types_accepted, [{ContentType, to_html}]), put_setting(process_post, {set_resp_redirect_but_not_location}), PostRequest = {url("post"), [], ContentType, "foo"}, - {ok, Result} = httpc:request(post, PostRequest, [], []), + {ok, Result} = httpc:request(post, PostRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 500, "Internal Server Error"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_N11_VIA_M7_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -950,7 +950,7 @@ see_other_n11_resource_calls_base_uri(Value) -> put_setting(create_path, {set_resp_redirect, ?RESOURCE_PATH ++ "/new1"}), put_setting(base_uri, Value), PostRequest = {url("post"), [], ContentType, "foo"}, - {ok, Result} = httpc:request(post, PostRequest, [{autoredirect,false}], []), + {ok, Result} = httpc:request(post, PostRequest, [{autoredirect,false}, {ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 303, "See Other"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_N11_VIA_M7_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -966,7 +966,7 @@ see_other_n5() -> put_setting(allow_missing_post, true), put_setting(process_post, {set_resp_redirect, ?RESOURCE_PATH ++ "/new1"}), PostRequest = {url("post"), [], ContentType, "foo"}, - {ok, Result} = httpc:request(post, PostRequest, [{autoredirect,false}], []), + {ok, Result} = httpc:request(post, PostRequest, [{autoredirect,false}, {ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 303, "See Other"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_N11_VIA_N5_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -976,7 +976,7 @@ see_other_n5() -> not_found_l7() -> put_setting(allowed_methods, ['GET', 'POST', 'PUT']), put_setting(resource_exists, false), - {ok, Result} = httpc:request(get, {url("nothere"), []}, [], []), + {ok, Result} = httpc:request(get, {url("nothere"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 404, "Object Not Found"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_L7_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -989,7 +989,7 @@ not_found_m7() -> ContentType = "text/html", put_setting(content_types_accepted, [{ContentType, to_html}]), PostRequest = {url("post"), [], ContentType, "foo"}, - {ok, Result} = httpc:request(post, PostRequest, [], []), + {ok, Result} = httpc:request(post, PostRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 404, "Object Not Found"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_M7_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1004,7 +1004,7 @@ created_p11_post() -> ContentType = "text/html", put_setting(content_types_accepted, [{ContentType, to_html}]), PostRequest = {url("post"), [], ContentType, "foo"}, - {ok, Result} = httpc:request(post, PostRequest, [], []), + {ok, Result} = httpc:request(post, PostRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 201, "Created"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_P11_VIA_N11_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1018,7 +1018,7 @@ created_p11_put() -> put_setting(content_types_accepted, [{ContentType, to_html}]), put_setting(is_conflict, {new_location, url("new")}), PutRequest = {url("put"), [], ContentType, "foo"}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 201, "Created"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_P11_VIA_P3_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1032,7 +1032,7 @@ conflict_p3() -> put_setting(content_types_accepted, [{ContentType, to_html}]), put_setting(is_conflict, true), PutRequest = {url("put"), [], ContentType, "foo"}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 409, "Conflict"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_P3_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1045,7 +1045,7 @@ conflict_o14() -> put_setting(content_types_accepted, [{ContentType, to_html}]), put_setting(is_conflict, true), PutRequest = {url("put"), [], ContentType, "foo"}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 409, "Conflict"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O14_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1056,7 +1056,7 @@ gone_m5() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(resource_exists, false), put_setting(previously_existed, true), - {ok, Result} = httpc:request(get, {url("gone"), []}, [], []), + {ok, Result} = httpc:request(get, {url("gone"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 410, "Gone"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_M5_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1070,7 +1070,7 @@ gone_n5() -> put_setting(resource_exists, false), put_setting(previously_existed, true), PostRequest = {url("post"), [], ContentType, "foo"}, - {ok, Result} = httpc:request(post, PostRequest, [], []), + {ok, Result} = httpc:request(post, PostRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 410, "Gone"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_N5_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1083,7 +1083,7 @@ accepted_m20() -> put_setting(delete_resource, true), put_setting(delete_completed, false), DeleteRequest = {url("doomed"), []}, - {ok, Result} = httpc:request(delete, DeleteRequest, [], []), + {ok, Result} = httpc:request(delete, DeleteRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 202, "Accepted"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_M20_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1100,7 +1100,7 @@ unsupported_media_type_accept_helper() -> put_setting(content_types_accepted, [{HTMLContent, to_html}]), put_setting(is_conflict, false), PutRequest = {url("put"), [], PlainTextContent, "foo"}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 415, "Unsupported Media Type"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O14_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1117,7 +1117,7 @@ created_p11_streamed() -> ContentType = "text/plain", FooPrime = string:copies("foo", 128), PostRequest = {url("post"), [], ContentType, FooPrime}, - {ok, Result} = httpc:request(post, PostRequest, [], []), + {ok, Result} = httpc:request(post, PostRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 201, "Created"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_P11_VIA_N11_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1158,7 +1158,7 @@ created_p11_accept_helper() -> put_setting(content_types_accepted, [{ContentType, accept_text}]), put_setting(is_conflict, {new_location, url("new")}), PutRequest = {url("put"), [], ContentType, FourtyTwoMugs}, - {ok, Result} = httpc:request(put, PutRequest, [], []), + {ok, Result} = httpc:request(put, PutRequest, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 201, "Created"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_P11_VIA_P3_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1177,7 +1177,7 @@ accept_text(ReqData, Context) -> writer_callback() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(content_types_provided, [{"text/plain", writer_response}]), - {ok, Result} = httpc:request(get, {url("foo"), []}, [], []), + {ok, Result} = httpc:request(get, {url("foo"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 200, "OK"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1195,7 +1195,7 @@ writer_response(ReqData, Context) -> head_length_access_for_cs() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(content_types_provided, [{"text/plain", known_length_body}]), - {ok, Result} = httpc:request(head, {url("knownlength"), []}, [], []), + {ok, Result} = httpc:request(head, {url("knownlength"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 200, "OK"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1205,7 +1205,7 @@ head_length_access_for_cs() -> get_known_length_for_cs() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(content_types_provided, [{"text/plain", known_length_body}]), - {ok, Result} = httpc:request(get, {url("knownlength"), []}, [], []), + {ok, Result} = httpc:request(get, {url("knownlength"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 200, "OK"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), @@ -1221,7 +1221,7 @@ known_length_body(ReqData, Context) -> get_for_range_capable_stream() -> put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS), put_setting(content_types_provided, [{"text/plain", range_response}]), - {ok, Result} = httpc:request(get, {url("foo"), []}, [], []), + {ok, Result} = httpc:request(get, {url("foo"), []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 200, "OK"}, _, _}, Result), ExpectedDecisionTrace = ?PATH_TO_O18_NO_ACPTHEAD, ?assertEqual(ExpectedDecisionTrace, get_decision_ids()), diff --git a/test/etag_test.erl b/test/etag_test.erl index 709f6fdb..587d9825 100644 --- a/test/etag_test.erl +++ b/test/etag_test.erl @@ -52,7 +52,7 @@ http_request(Match, IfVals, NewVal, Count) -> [{Match, etag_list(IfVals)}], "binary/octet-stream", NewVal}, - [], []) of + [{ssl, [{verify, verify_none}]}], []) of {ok, Result} -> {ok, Result}; {error, socket_closed_remotely} -> diff --git a/test/wm_integration_test_util.erl b/test/wm_integration_test_util.erl index b70b23be..456d5f6c 100644 --- a/test/wm_integration_test_util.erl +++ b/test/wm_integration_test_util.erl @@ -140,7 +140,7 @@ integration_test_() -> service_unavailable_test(Ctx) -> URL = wm_integration_test_util:url(Ctx, "foo"), - {ok, Result} = httpc:request(head, {URL, []}, [], []), + {ok, Result} = httpc:request(head, {URL, []}, [{ssl, [{verify, verify_none}]}], []), ?assertMatch({{"HTTP/1.1", 503, "Service Unavailable"}, _, _}, Result), ok.