OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::anonymous_namespace{WebUserLoginDialog.cpp} Namespace Reference

Functions

int reserve_loopback_port ()
std::string rewrite_loopback_url (std::string url, int port)

Function Documentation

◆ reserve_loopback_port()

int Slic3r::GUI::anonymous_namespace{WebUserLoginDialog.cpp}::reserve_loopback_port ( )
71{
72 try {
73 boost::asio::io_context io_service;
74 boost::asio::ip::tcp::acceptor acceptor(io_service, {boost::asio::ip::tcp::v4(), 0});
75 return static_cast<int>(acceptor.local_endpoint().port());
76 } catch (...) {
77 return 0;
78 }
79}

References reserve_loopback_port().

Referenced by reserve_loopback_port().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rewrite_loopback_url()

std::string Slic3r::GUI::anonymous_namespace{WebUserLoginDialog.cpp}::rewrite_loopback_url ( std::string url,
int port )
82{
83 if (port <= 0) {
84 return url;
85 }
86
87 const std::string old_port = std::to_string(LOCALHOST_PORT);
88 const std::string new_port = std::to_string(port);
89
90 boost::replace_all(url, std::string(LOCALHOST_URL) + old_port, std::string(LOCALHOST_URL) + new_port);
91 boost::replace_all(url, "http://127.0.0.1:" + old_port, "http://127.0.0.1:" + new_port);
92 boost::replace_all(url, "http%3A%2F%2Flocalhost%3A" + old_port, "http%3A%2F%2Flocalhost%3A" + new_port);
93 boost::replace_all(url, "http%3A%2F%2F127.0.0.1%3A" + old_port, "http%3A%2F%2F127.0.0.1%3A" + new_port);
94
95 return url;
96}
#define LOCALHOST_URL
Definition HttpServer.hpp:26
#define LOCALHOST_PORT
Definition HttpServer.hpp:25

References LOCALHOST_PORT, LOCALHOST_URL, and rewrite_loopback_url().

Referenced by rewrite_loopback_url().

Here is the call graph for this function:
Here is the caller graph for this function: