mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 03:07:55 -06:00
Fixed not get port when obtaining the host. (#5423)
Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
parent
b021c615f5
commit
95c3255c27
1 changed files with 9 additions and 2 deletions
|
@ -50,8 +50,15 @@ std::string get_host_from_url(const std::string& url_in)
|
||||||
char* host;
|
char* host;
|
||||||
rc = curl_url_get(hurl, CURLUPART_HOST, &host, 0);
|
rc = curl_url_get(hurl, CURLUPART_HOST, &host, 0);
|
||||||
if (rc == CURLUE_OK) {
|
if (rc == CURLUE_OK) {
|
||||||
out = host;
|
char* port;
|
||||||
curl_free(host);
|
rc = curl_url_get(hurl, CURLUPART_PORT, &port, 0);
|
||||||
|
if (rc == CURLUE_OK && port != nullptr) {
|
||||||
|
out = std::string(host) + ":" + port;
|
||||||
|
curl_free(port);
|
||||||
|
} else {
|
||||||
|
out = host;
|
||||||
|
curl_free(host);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
BOOST_LOG_TRIVIAL(error) << "OctoPrint get_host_from_url: failed to get host form URL " << url;
|
BOOST_LOG_TRIVIAL(error) << "OctoPrint get_host_from_url: failed to get host form URL " << url;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue