Removed httpd utilities
This commit is contained in:
@ -30,7 +30,6 @@ set(dependencies
|
||||
esp_system
|
||||
# esp_http_client
|
||||
esp_websocket_client
|
||||
nghttp
|
||||
tcp_transport
|
||||
|
||||
cpputils
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
#include <http_parser.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <fmt/core.h>
|
||||
@ -27,44 +26,4 @@ std::string toString(sntp_sync_mode_t val)
|
||||
}
|
||||
}
|
||||
|
||||
void urldecode(char *dst, const char *src)
|
||||
{
|
||||
while (*src) {
|
||||
char a, b;
|
||||
if ((*src == '%') && ((a = src[1]) && (b = src[2])) && (std::isxdigit(a) && std::isxdigit(b))) {
|
||||
if (a >= 'a')
|
||||
a -= 'a'-'A';
|
||||
if (a >= 'A')
|
||||
a -= ('A' - 10);
|
||||
else
|
||||
a -= '0';
|
||||
|
||||
if (b >= 'a')
|
||||
b -= 'a'-'A';
|
||||
if (b >= 'A')
|
||||
b -= ('A' - 10);
|
||||
else
|
||||
b -= '0';
|
||||
|
||||
*dst++ = 16*a+b;
|
||||
src+=3;
|
||||
} else if (*src == '+') {
|
||||
*dst++ = ' ';
|
||||
src++;
|
||||
} else
|
||||
*dst++ = *src++;
|
||||
}
|
||||
|
||||
*dst++ = '\0';
|
||||
}
|
||||
|
||||
tl::expected<void, std::string> urlverify(std::string_view str)
|
||||
{
|
||||
http_parser_url puri;
|
||||
http_parser_url_init(&puri);
|
||||
if (const auto result = http_parser_parse_url(str.data(), str.size(), 0, &puri); result != 0)
|
||||
return tl::make_unexpected(fmt::format("http_parser_parse_url() failed parsing the url with {}", result));
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace espcpputils
|
||||
|
@ -6,15 +6,8 @@
|
||||
// esp-idf includes
|
||||
#include <esp_sntp.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tl/expected.hpp>
|
||||
|
||||
namespace espcpputils {
|
||||
|
||||
std::string toString(sntp_sync_mode_t val);
|
||||
|
||||
void urldecode(char *dst, const char *src);
|
||||
|
||||
tl::expected<void, std::string> urlverify(std::string_view str);
|
||||
|
||||
} // namespace espcpputils
|
||||
|
Reference in New Issue
Block a user