diff --git a/rpc/http.go b/rpc/http.go index a0a3ad498c..bb85de60a8 100644 --- a/rpc/http.go +++ b/rpc/http.go @@ -27,12 +27,13 @@ import ( "mime" "net" "net/http" + "runtime/debug" "strings" "sync" "time" - "github.com/rs/cors" "github.com/ethereum/go-ethereum/log" + "github.com/rs/cors" ) const ( @@ -71,7 +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)) + log.Debug(fmt.Sprintf("connecting to HTTP endpoint %s", endpoint)) if err != nil { return nil, err } @@ -92,15 +93,14 @@ func DialHTTP(endpoint string) (*Client, error) { func (c *Client) sendHTTP(ctx context.Context, op *requestOp, msg interface{}) error { hc := c.writeConn.(*httpConn) respBody, err := hc.doRequest(ctx, msg) - log.Debug(fmt.Sprintf("Sending message %s",msg)) if err != nil { return err } defer respBody.Close() var respmsg jsonrpcMessage - log.Debug(fmt.Sprintf("Got response %s",respmsg)) if err := json.NewDecoder(respBody).Decode(&respmsg); err != nil { - log.Debug(fmt.Sprintf("Error decoding JSON response: %s", err)) + err := fmt.Errorf("Error creating HTTP connection to RPC socket. Did you set --rpcvhosts on the server? Actual error is \"%s\"", err) + debug.PrintStack() return err } op.resp <- &respmsg