1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00
Files
esp8266/libraries/Bridge/src/HttpClient.cpp
Federico Fissore cdf70e501d Adds parameter "-k" to every way of calling curl, hence allowing
calling https URLs without checking for the validity of SSL
certificates.
While this makes it a little insecure, nothing else can be done
while keeping the HTTPClient API simple: openwrt does not have a
SSL certificates bundle
Advanced users concerned about security should call "curl" on
their own using Process, supplying parameters such as "--cacert"
Fixes #1860
2014-05-21 09:47:49 +02:00

58 lines
1.4 KiB
C++

/*
Copyright (c) 2013 Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "HttpClient.h"
unsigned int HttpClient::get(String &url) {
begin("curl");
addParameter("-k");
addParameter(url);
return run();
}
unsigned int HttpClient::get(const char *url) {
begin("curl");
addParameter("-k");
addParameter(url);
return run();
}
void HttpClient::getAsynchronously(String &url) {
begin("curl");
addParameter("-k");
addParameter(url);
runAsynchronously();
}
void HttpClient::getAsynchronously(const char *url) {
begin("curl");
addParameter("-k");
addParameter(url);
runAsynchronously();
}
boolean HttpClient::ready() {
return !running();
}
unsigned int HttpClient::getResult() {
return exitValue();
}