Skip to content

Commit a45792a

Browse files
Eugene Ostroukhovaddaleax
Eugene Ostroukhov
authored andcommitted
inspector: perform DNS lookup for host
PR-URL: #13478 Fixes: #13477 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 820b011 commit a45792a

7 files changed

+343
-163
lines changed

src/inspector_agent.cc

+1-7
Original file line numberDiff line numberDiff line change
@@ -702,13 +702,7 @@ void Url(const FunctionCallbackInfo<Value>& args) {
702702

703703
if (ids.empty()) return;
704704

705-
std::string url = "ws://";
706-
url += io->host();
707-
url += ":";
708-
url += std::to_string(io->port());
709-
url += "/";
710-
url += ids[0];
711-
705+
std::string url = FormatWsAddress(io->host(), io->port(), ids[0], true);
712706
args.GetReturnValue().Set(OneByteString(env->isolate(), url.c_str()));
713707
}
714708

src/inspector_io.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ void InspectorIo::ThreadMain() {
313313
uv_sem_post(&thread_start_sem_);
314314
return;
315315
}
316-
port_ = server.port(); // Safe, main thread is waiting on semaphore.
316+
port_ = server.Port(); // Safe, main thread is waiting on semaphore.
317317
if (!wait_for_connect_) {
318318
uv_sem_post(&thread_start_sem_);
319319
}

src/inspector_io.h

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ class StringView;
2828
namespace node {
2929
namespace inspector {
3030

31+
std::string FormatWsAddress(const std::string& host, int port,
32+
const std::string& target_id,
33+
bool include_protocol);
34+
3135
class InspectorIoDelegate;
3236

3337
enum class InspectorAction {

src/inspector_socket.h

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class InspectorSocket {
6363
bool ws_mode;
6464
bool shutting_down;
6565
bool connection_eof;
66+
6667
private:
6768
DISALLOW_COPY_AND_ASSIGN(InspectorSocket);
6869
};

0 commit comments

Comments
 (0)