aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/api.go13
-rw-r--r--rpc/http/server.go8
2 files changed, 8 insertions, 13 deletions
diff --git a/rpc/api.go b/rpc/api.go
index ae1e1504f..70a8cf9b4 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -9,7 +9,6 @@ For each request type, define the following:
package rpc
import (
- "fmt"
"math/big"
"strings"
"sync"
@@ -23,7 +22,6 @@ import (
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/state"
- "github.com/ethereum/go-ethereum/ui"
"github.com/ethereum/go-ethereum/xeth"
)
@@ -721,14 +719,3 @@ func (self *EthereumApi) useState(statedb *state.StateDB) {
self.eth = self.eth.UseState(statedb)
}
-
-func t(f ui.Frontend) {
- // Call the password dialog
- ret, err := f.Call("PasswordDialog")
- if err != nil {
- fmt.Println(err)
- }
- // Get the first argument
- t, _ := ret.Get(0)
- fmt.Println("return:", t)
-}
diff --git a/rpc/http/server.go b/rpc/http/server.go
index 452b7c9af..d8f0157f1 100644
--- a/rpc/http/server.go
+++ b/rpc/http/server.go
@@ -29,6 +29,8 @@ import (
var rpchttplogger = logger.NewLogger("RPC-HTTP")
var JSON rpc.JsonWrapper
+const maxSizeReqLength = 1024 * 1024 // 1MB
+
func NewRpcHttpServer(pipe *xeth.XEth, address string, port int) (*RpcHttpServer, error) {
sport := fmt.Sprintf("%s:%d", address, port)
l, err := net.Listen("tcp", sport)
@@ -92,6 +94,12 @@ func (s *RpcHttpServer) apiHandler(api *rpc.EthereumApi) http.Handler {
rpchttplogger.DebugDetailln("Handling request")
+ if req.ContentLength > maxSizeReqLength {
+ jsonerr := &rpc.RpcErrorObject{-32700, "Error: Request too large"}
+ JSON.Send(w, &rpc.RpcErrorResponse{JsonRpc: jsonrpcver, ID: nil, Error: jsonerr})
+ return
+ }
+
reqParsed, reqerr := JSON.ParseRequestBody(req)
if reqerr != nil {
jsonerr := &rpc.RpcErrorObject{-32700, "Error: Could not parse request"}