mirror of https://github.com/arendst/Tasmota.git
support https URL (#19582)
This commit is contained in:
parent
9ff65d76cc
commit
0d7c2dee72
|
@ -118,15 +118,15 @@ String InfluxDbAuth(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InfluxDbHostByName(void) {
|
bool InfluxDbHostByName(void) {
|
||||||
IPAddress ifdb_ip;
|
String host = SettingsText(SET_INFLUXDB_HOST);
|
||||||
if (!WifiHostByName(SettingsText(SET_INFLUXDB_HOST), ifdb_ip)) {
|
IFDB._serverUrl = "";
|
||||||
AddLog(LOG_LEVEL_DEBUG, PSTR("IFX: Invalid ifxhost"));
|
if (strncmp(host.c_str(),"http",4))
|
||||||
return false;
|
IFDB._serverUrl += "http://";
|
||||||
}
|
IFDB._serverUrl += host;
|
||||||
IFDB._serverUrl = "http://";
|
if (Settings->influxdb_port) {
|
||||||
IFDB._serverUrl += ifdb_ip.toString();
|
|
||||||
IFDB._serverUrl += ":";
|
IFDB._serverUrl += ":";
|
||||||
IFDB._serverUrl += Settings->influxdb_port;
|
IFDB._serverUrl += Settings->influxdb_port;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ void InfluxDbAfterRequest(int expectedStatusCode, bool modifyLastConnStatus) {
|
||||||
IFDB._lastErrorResponse = IFDBhttpClient->errorToString(IFDB._lastStatusCode);
|
IFDB._lastErrorResponse = IFDBhttpClient->errorToString(IFDB._lastStatusCode);
|
||||||
}
|
}
|
||||||
IFDB._lastErrorResponse.trim(); // Remove trailing \n
|
IFDB._lastErrorResponse.trim(); // Remove trailing \n
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("IFX: Error %s"), IFDB._lastErrorResponse.c_str());
|
AddLog(LOG_LEVEL_INFO, PSTR("IFX: Error '%s'"), IFDB._lastErrorResponse.c_str());
|
||||||
} else {
|
} else {
|
||||||
AddLog(IFDB.log_level, PSTR("IFX: Done"));
|
AddLog(IFDB.log_level, PSTR("IFX: Done"));
|
||||||
}
|
}
|
||||||
|
@ -274,6 +274,7 @@ int InfluxDbPostData(const char *data) {
|
||||||
IFDBhttpClient->addHeader(F("Content-Type"), F("text/plain"));
|
IFDBhttpClient->addHeader(F("Content-Type"), F("text/plain"));
|
||||||
InfluxDbBeforeRequest();
|
InfluxDbBeforeRequest();
|
||||||
IFDB._lastStatusCode = IFDBhttpClient->POST((uint8_t*)data, strlen(data));
|
IFDB._lastStatusCode = IFDBhttpClient->POST((uint8_t*)data, strlen(data));
|
||||||
|
AddLog(IFDB.log_level, PSTR("IFX: POST statusCode %d"), IFDB._lastStatusCode);
|
||||||
InfluxDbAfterRequest(204, true);
|
InfluxDbAfterRequest(204, true);
|
||||||
IFDBhttpClient->end();
|
IFDBhttpClient->end();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue