Skip to content

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

Merged
fjl merged 3 commits intoethereum:masterfrom
holiman:fix_httpport
Mar 23, 2020
Merged

node, cmd/clef: report actual port used for http rpc#20789
fjl merged 3 commits intoethereum:masterfrom
holiman:fix_httpport

Conversation

@holiman
Copy link
Copy Markdown
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

Comment thread cmd/clef/main.go Outdated
Comment thread node/node.go
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread node/node.go Outdated
Comment thread cmd/clef/main.go Outdated
@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
MariusVanDerWijden pushed a commit to MariusVanDerWijden/go-ethereum that referenced this pull request Feb 2, 2026
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