Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/geth/consolecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func localConsole(ctx *cli.Context) error {

console, err := console.New(config)
if err != nil {
utils.Fatalf("Failed to start the JavaScript console: %v", err)
utils.Fatalf("Failed to start the local JavaScript console: %v", err)
}
defer console.Stop(false)

Expand Down Expand Up @@ -143,7 +143,7 @@ func remoteConsole(ctx *cli.Context) error {

console, err := console.New(config)
if err != nil {
utils.Fatalf("Failed to start the JavaScript console: %v", err)
utils.Fatalf("Failed to start the remote JavaScript console: %v", err)
}
defer console.Stop(false)

Expand Down Expand Up @@ -196,7 +196,7 @@ func ephemeralConsole(ctx *cli.Context) error {

console, err := console.New(config)
if err != nil {
utils.Fatalf("Failed to start the JavaScript console: %v", err)
utils.Fatalf("Failed to start the ephemeral JavaScript console: %v", err)
}
defer console.Stop(false)

Expand Down
2 changes: 1 addition & 1 deletion console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (c *Console) init(preload []string) error {
// Load the supported APIs into the JavaScript runtime environment
apis, err := c.client.SupportedModules()
if err != nil {
return fmt.Errorf("api modules: %v", err)
return fmt.Errorf("cannot create api client modules: %v", err)
}
flatten := "var eth = web3.eth; var personal = web3.personal; "
for api := range apis {
Expand Down
5 changes: 5 additions & 0 deletions rpc/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ import (
"mime"
"net"
"net/http"
"runtime/debug"
"strings"
"sync"
"time"

"github.com/ethereum/go-ethereum/log"
"github.com/rs/cors"
)

Expand Down Expand Up @@ -70,6 +72,7 @@ func (hc *httpConn) Close() error {
// using the provided HTTP Client.
func DialHTTPWithClient(endpoint string, client *http.Client) (*Client, error) {
req, err := http.NewRequest(http.MethodPost, endpoint, nil)
log.Debug(fmt.Sprintf("connecting to HTTP endpoint %s", endpoint))
if err != nil {
return nil, err
}
Expand All @@ -96,6 +99,8 @@ func (c *Client) sendHTTP(ctx context.Context, op *requestOp, msg interface{}) e
defer respBody.Close()
var respmsg jsonrpcMessage
if err := json.NewDecoder(respBody).Decode(&respmsg); err != nil {
err := fmt.Errorf("Error creating HTTP connection to RPC socket. Did you set --rpcvhosts on the server? Actual error is \"%s\"", err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You are reassigning the err here. What should happen is that the server should respond with a json-rpc error, saying that the host header was wrong, and we should just bubble that up. So if that's not happening, it would be better to try to discover why that is.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

indeed, I don't know why that is and don't know how to determine the source. I have debugging notes in the referenced issue.

debug.PrintStack()
return err
}
op.resp <- &respmsg
Expand Down