Skip to content

Commit ed737a1

Browse files
committed
Fix IP auto-detect: use ifconfig.me/ip with curl User-Agent
ifconfig.me returns full HTML page for non-curl User-Agents on /. Use /ip endpoint with curl User-Agent to get plain text IP.
1 parent 164ee0e commit ed737a1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/core/web_server.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4731,9 +4731,10 @@ void MiningInterface::auto_detect_external_info()
47314731
boost::asio::connect(sock, endpoints);
47324732

47334733
std::string req =
4734-
"GET / HTTP/1.0\r\n"
4734+
"GET /ip HTTP/1.0\r\n"
47354735
"Host: ifconfig.me\r\n"
4736-
"User-Agent: c2pool/0.1\r\n"
4736+
"User-Agent: curl/8.0\r\n"
4737+
"Accept: text/plain\r\n"
47374738
"Connection: close\r\n\r\n";
47384739
boost::asio::write(sock, boost::asio::buffer(req));
47394740

0 commit comments

Comments
 (0)