Http: consolidate get_host_from_url() into Http class

Move duplicate get_host_from_url() implementations from ElegooLink and
OctoPrint into Http as a static method using the curl_url API. This
eliminates code duplication and provides a single reliable URL host
extraction utility for all print host implementations.

Signed-off-by: Igor Mammedov <niallain@gmail.com>
This commit is contained in:
Igor Mammedov
2026-05-16 15:53:40 +02:00
parent 8a650ec672
commit 376841e28e
5 changed files with 63 additions and 135 deletions

View File

@@ -204,6 +204,8 @@ public:
static std::string url_decode(const std::string &str);
static std::string get_filename_from_url(const std::string &url);
static std::string get_host_from_url(const std::string &url, std::string *port = nullptr);
static std::string get_host_header_value(const std::string &url);
private:
Http(const std::string &url);