Skip to content

Commit

Permalink
inspector: perform DNS lookup for host
Browse files Browse the repository at this point in the history
PR-URL: #13478
Fixes: #13477
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
Eugene Ostroukhov authored and addaleax committed Jul 11, 2017
1 parent 820b011 commit a45792a
Show file tree
Hide file tree
Showing 7 changed files with 343 additions and 163 deletions.
8 changes: 1 addition & 7 deletions src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,7 @@ void Url(const FunctionCallbackInfo<Value>& args) {

if (ids.empty()) return;

std::string url = "ws://";
url += io->host();
url += ":";
url += std::to_string(io->port());
url += "/";
url += ids[0];

std::string url = FormatWsAddress(io->host(), io->port(), ids[0], true);
args.GetReturnValue().Set(OneByteString(env->isolate(), url.c_str()));
}

Expand Down
2 changes: 1 addition & 1 deletion src/inspector_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ void InspectorIo::ThreadMain() {
uv_sem_post(&thread_start_sem_);
return;
}
port_ = server.port(); // Safe, main thread is waiting on semaphore.
port_ = server.Port(); // Safe, main thread is waiting on semaphore.
if (!wait_for_connect_) {
uv_sem_post(&thread_start_sem_);
}
Expand Down
4 changes: 4 additions & 0 deletions src/inspector_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class StringView;
namespace node {
namespace inspector {

std::string FormatWsAddress(const std::string& host, int port,
const std::string& target_id,
bool include_protocol);

class InspectorIoDelegate;

enum class InspectorAction {
Expand Down
1 change: 1 addition & 0 deletions src/inspector_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class InspectorSocket {
bool ws_mode;
bool shutting_down;
bool connection_eof;

private:
DISALLOW_COPY_AND_ASSIGN(InspectorSocket);
};
Expand Down
Loading

0 comments on commit a45792a

Please sign in to comment.