Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
676a0de5
Commit
676a0de5
authored
Mar 09, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Max size JSON data. Closes #418
parent
20741a96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
server.go
rpc/http/server.go
+8
-0
No files found.
rpc/http/server.go
View file @
676a0de5
...
@@ -29,6 +29,8 @@ import (
...
@@ -29,6 +29,8 @@ import (
var
rpchttplogger
=
logger
.
NewLogger
(
"RPC-HTTP"
)
var
rpchttplogger
=
logger
.
NewLogger
(
"RPC-HTTP"
)
var
JSON
rpc
.
JsonWrapper
var
JSON
rpc
.
JsonWrapper
const
maxSizeReqLength
=
1024
*
1024
// 1MB
func
NewRpcHttpServer
(
pipe
*
xeth
.
XEth
,
address
string
,
port
int
)
(
*
RpcHttpServer
,
error
)
{
func
NewRpcHttpServer
(
pipe
*
xeth
.
XEth
,
address
string
,
port
int
)
(
*
RpcHttpServer
,
error
)
{
sport
:=
fmt
.
Sprintf
(
"%s:%d"
,
address
,
port
)
sport
:=
fmt
.
Sprintf
(
"%s:%d"
,
address
,
port
)
l
,
err
:=
net
.
Listen
(
"tcp"
,
sport
)
l
,
err
:=
net
.
Listen
(
"tcp"
,
sport
)
...
@@ -92,6 +94,12 @@ func (s *RpcHttpServer) apiHandler(api *rpc.EthereumApi) http.Handler {
...
@@ -92,6 +94,12 @@ func (s *RpcHttpServer) apiHandler(api *rpc.EthereumApi) http.Handler {
rpchttplogger
.
DebugDetailln
(
"Handling request"
)
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
)
reqParsed
,
reqerr
:=
JSON
.
ParseRequestBody
(
req
)
if
reqerr
!=
nil
{
if
reqerr
!=
nil
{
jsonerr
:=
&
rpc
.
RpcErrorObject
{
-
32700
,
"Error: Could not parse request"
}
jsonerr
:=
&
rpc
.
RpcErrorObject
{
-
32700
,
"Error: Could not parse request"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment