mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Added [no]checkSSL method that sets an "insecure" boolean flag.
If insecure, "-k" parameter is added to curl and SSL certificates are not checked
This commit is contained in:
@ -18,30 +18,43 @@
|
||||
|
||||
#include "HttpClient.h"
|
||||
|
||||
HttpClient::HttpClient() :
|
||||
insecure(false) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
unsigned int HttpClient::get(String &url) {
|
||||
begin("curl");
|
||||
addParameter("-k");
|
||||
if (insecure) {
|
||||
addParameter("-k");
|
||||
}
|
||||
addParameter(url);
|
||||
return run();
|
||||
}
|
||||
|
||||
unsigned int HttpClient::get(const char *url) {
|
||||
begin("curl");
|
||||
addParameter("-k");
|
||||
if (insecure) {
|
||||
addParameter("-k");
|
||||
}
|
||||
addParameter(url);
|
||||
return run();
|
||||
}
|
||||
|
||||
void HttpClient::getAsynchronously(String &url) {
|
||||
begin("curl");
|
||||
addParameter("-k");
|
||||
if (insecure) {
|
||||
addParameter("-k");
|
||||
}
|
||||
addParameter(url);
|
||||
runAsynchronously();
|
||||
}
|
||||
|
||||
void HttpClient::getAsynchronously(const char *url) {
|
||||
begin("curl");
|
||||
addParameter("-k");
|
||||
if (insecure) {
|
||||
addParameter("-k");
|
||||
}
|
||||
addParameter(url);
|
||||
runAsynchronously();
|
||||
}
|
||||
@ -54,4 +67,11 @@ unsigned int HttpClient::getResult() {
|
||||
return exitValue();
|
||||
}
|
||||
|
||||
void HttpClient::noCheckSSL() {
|
||||
insecure = true;
|
||||
}
|
||||
|
||||
void HttpClient::checkSSL() {
|
||||
insecure = false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user