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
abc3d8d5
Commit
abc3d8d5
authored
Mar 19, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make send internal
parent
c7b616ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
http.go
rpc/http.go
+6
-6
No files found.
rpc/http.go
View file @
abc3d8d5
...
@@ -28,7 +28,7 @@ func JSONRPC(pipe *xeth.XEth, dataDir string) http.Handler {
...
@@ -28,7 +28,7 @@ func JSONRPC(pipe *xeth.XEth, dataDir string) http.Handler {
// Limit request size to resist DoS
// Limit request size to resist DoS
if
req
.
ContentLength
>
maxSizeReqLength
{
if
req
.
ContentLength
>
maxSizeReqLength
{
jsonerr
:=
&
RpcErrorObject
{
-
32700
,
"Request too large"
}
jsonerr
:=
&
RpcErrorObject
{
-
32700
,
"Request too large"
}
S
end
(
w
,
&
RpcErrorResponse
{
Jsonrpc
:
jsonrpcver
,
Id
:
nil
,
Error
:
jsonerr
})
s
end
(
w
,
&
RpcErrorResponse
{
Jsonrpc
:
jsonrpcver
,
Id
:
nil
,
Error
:
jsonerr
})
return
return
}
}
...
@@ -37,14 +37,14 @@ func JSONRPC(pipe *xeth.XEth, dataDir string) http.Handler {
...
@@ -37,14 +37,14 @@ func JSONRPC(pipe *xeth.XEth, dataDir string) http.Handler {
body
,
err
:=
ioutil
.
ReadAll
(
req
.
Body
)
body
,
err
:=
ioutil
.
ReadAll
(
req
.
Body
)
if
err
!=
nil
{
if
err
!=
nil
{
jsonerr
:=
&
RpcErrorObject
{
-
32700
,
"Could not read request body"
}
jsonerr
:=
&
RpcErrorObject
{
-
32700
,
"Could not read request body"
}
S
end
(
w
,
&
RpcErrorResponse
{
Jsonrpc
:
jsonrpcver
,
Id
:
nil
,
Error
:
jsonerr
})
s
end
(
w
,
&
RpcErrorResponse
{
Jsonrpc
:
jsonrpcver
,
Id
:
nil
,
Error
:
jsonerr
})
}
}
// Try to parse the request as a single
// Try to parse the request as a single
var
reqSingle
RpcRequest
var
reqSingle
RpcRequest
if
err
:=
json
.
Unmarshal
(
body
,
&
reqSingle
);
err
==
nil
{
if
err
:=
json
.
Unmarshal
(
body
,
&
reqSingle
);
err
==
nil
{
response
:=
RpcResponse
(
api
,
&
reqSingle
)
response
:=
RpcResponse
(
api
,
&
reqSingle
)
S
end
(
w
,
&
response
)
s
end
(
w
,
&
response
)
return
return
}
}
...
@@ -57,13 +57,13 @@ func JSONRPC(pipe *xeth.XEth, dataDir string) http.Handler {
...
@@ -57,13 +57,13 @@ func JSONRPC(pipe *xeth.XEth, dataDir string) http.Handler {
response
:=
RpcResponse
(
api
,
&
request
)
response
:=
RpcResponse
(
api
,
&
request
)
resBatch
[
i
]
=
response
resBatch
[
i
]
=
response
}
}
S
end
(
w
,
resBatch
)
s
end
(
w
,
resBatch
)
return
return
}
}
// Not a batch or single request, error
// Not a batch or single request, error
jsonerr
:=
&
RpcErrorObject
{
-
32600
,
"Could not decode request"
}
jsonerr
:=
&
RpcErrorObject
{
-
32600
,
"Could not decode request"
}
S
end
(
w
,
&
RpcErrorResponse
{
Jsonrpc
:
jsonrpcver
,
Id
:
nil
,
Error
:
jsonerr
})
s
end
(
w
,
&
RpcErrorResponse
{
Jsonrpc
:
jsonrpcver
,
Id
:
nil
,
Error
:
jsonerr
})
})
})
}
}
...
@@ -88,7 +88,7 @@ func RpcResponse(api *EthereumApi, request *RpcRequest) *interface{} {
...
@@ -88,7 +88,7 @@ func RpcResponse(api *EthereumApi, request *RpcRequest) *interface{} {
return
&
response
return
&
response
}
}
func
S
end
(
writer
io
.
Writer
,
v
interface
{})
(
n
int
,
err
error
)
{
func
s
end
(
writer
io
.
Writer
,
v
interface
{})
(
n
int
,
err
error
)
{
var
payload
[]
byte
var
payload
[]
byte
payload
,
err
=
json
.
MarshalIndent
(
v
,
""
,
"
\t
"
)
payload
,
err
=
json
.
MarshalIndent
(
v
,
""
,
"
\t
"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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