Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node, cmd/clef: report actual port used for http rpc #20789

Merged
merged 3 commits into from
Mar 23, 2020

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Mar 20, 2020

This PR fixes and issue where, if you specify --rpcport=0, you get

HTTP endpoint opened                     url=http://127.0.0.1:0 cors= vhosts=localhost

Port 0 means "hey OS, please give me a free port". We should output the actual
port given to us by the OS in this case.

With this PR:

geth

INFO [03-20|10:11:00.749] IPC endpoint opened                      url=/tmp/geth.ipc
INFO [03-20|10:11:00.749] HTTP endpoint opened                     url=http://127.0.0.1:43157/ cors= vhosts=localhost
...
INFO [03-20|10:11:02.546] HTTP endpoint closed                     url=http://127.0.0.1:43157
INFO [03-20|10:11:02.546] IPC endpoint closed                      url=/tmp/geth.ipc

clef

DEBUG[03-20|10:10:16.333] HTTP registered                          namespace=account
INFO [03-20|10:10:16.333] HTTP endpoint opened                     url=http://127.0.0.1:39755
...
INFO [03-20|10:10:19.130] IPC endpoint closed                      url=/home/user/.clef/clef.ipc
INFO [03-20|10:10:19.130] HTTP endpoint closed                     url=http://127.0.0.1:39755

cmd/clef/main.go Outdated Show resolved Hide resolved
@@ -368,7 +368,9 @@ func (n *Node) startHTTP(endpoint string, apis []rpc.API, modules []string, cors
if err != nil {
return err
}
n.log.Info("HTTP endpoint opened", "url", fmt.Sprintf("http://%s", endpoint), "cors", strings.Join(cors, ","), "vhosts", strings.Join(vhosts, ","))
n.log.Info("HTTP endpoint opened", "url", fmt.Sprintf("http://%v/", listener.Addr()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the trailing / accidental or deliberate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accidental... :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No wait, it's actually correct to use a trailing slash there. I think it's the more correct URL, since it's a GET / HTTP/1,1 -- a domain is not a valid url

node/node.go Outdated Show resolved Hide resolved
cmd/clef/main.go Outdated Show resolved Hide resolved
@fjl fjl merged commit 0734c4b into ethereum:master Mar 23, 2020
@karalabe karalabe added this to the 1.9.13 milestone Mar 27, 2020
enriquefynn pushed a commit to enriquefynn/go-ethereum that referenced this pull request Mar 10, 2021
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Nov 4, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Nov 4, 2024
wanwiset25 pushed a commit to XinFinOrg/XDPoSChain that referenced this pull request Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants