@@ -27,6 +27,10 @@ template <HttpMethod Method, class T>
2727void AsyncHttpClient::send (const HttpCallback& p_callback,
2828 const Red::CString& p_url, const T& p_body,
2929 const Red::Optional<HttpHeaders>& p_headers) {
30+ if (!HttpClient::is_secure (p_url)) {
31+ p_callback ({});
32+ return ;
33+ }
3034 if constexpr (std::is_same<T, Red::CString>()) {
3135 send_body<Method>(p_callback, p_url, p_body, p_headers);
3236 } else if constexpr (std::is_same<T, HttpPairs>()) {
@@ -41,10 +45,6 @@ void AsyncHttpClient::send_body(const HttpCallback& p_callback,
4145 const Red::CString& p_url,
4246 const Red::CString& p_body,
4347 const Red::Optional<HttpHeaders>& p_headers) {
44- if (!HttpClient::is_secure (p_url)) {
45- p_callback ({});
46- return ;
47- }
4848 cpr::Header request_headers = HttpClient::build_headers (p_headers.value );
4949
5050 if (!request_headers.contains (" Content-Type" )) {
@@ -79,10 +79,6 @@ void AsyncHttpClient::send_form(const HttpCallback& p_callback,
7979 const Red::CString& p_url,
8080 const HttpPairs& p_form,
8181 const Red::Optional<HttpHeaders>& p_headers) {
82- if (!HttpClient::is_secure (p_url)) {
83- p_callback ({});
84- return ;
85- }
8682 std::vector<cpr::Pair> values;
8783
8884 for (const auto & pair : p_form) {
@@ -122,10 +118,6 @@ void AsyncHttpClient::send_multipart(
122118 const HttpCallback& p_callback, const Red::CString& p_url,
123119 const Red::Handle<HttpMultipart>& p_form,
124120 const Red::Optional<HttpHeaders>& p_headers) {
125- if (!HttpClient::is_secure (p_url)) {
126- p_callback ({});
127- return ;
128- }
129121 cpr::Header request_headers = HttpClient::build_headers (p_headers.value );
130122
131123 plugin->log_request (Method, p_url, p_form, request_headers);
0 commit comments