Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
exchain
nebula
Commits
90d9c3ac
Commit
90d9c3ac
authored
Jan 20, 2022
by
Matthew Slipper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CR updates
parent
1760613c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
rpc.go
go/proxyd/rpc.go
+11
-0
server.go
go/proxyd/server.go
+2
-2
No files found.
go/proxyd/rpc.go
View file @
90d9c3ac
...
...
@@ -111,3 +111,14 @@ func NewRPCErrorRes(id json.RawMessage, err error) *RPCRes {
ID
:
id
,
}
}
func
IsBatch
(
raw
[]
byte
)
bool
{
for
_
,
c
:=
range
raw
{
// skip insignificant whitespace (http://www.ietf.org/rfc/rfc4627.txt)
if
c
==
0x20
||
c
==
0x09
||
c
==
0x0a
||
c
==
0x0d
{
continue
}
return
c
==
'['
}
return
false
}
\ No newline at end of file
go/proxyd/server.go
View file @
90d9c3ac
...
...
@@ -24,7 +24,7 @@ const (
ContextKeyAuth
=
"authorization"
ContextKeyReqID
=
"req_id"
ContextKeyXForwardedFor
=
"x_forwarded_for"
MaxBatchRPCCalls
=
25
MaxBatchRPCCalls
=
100
)
type
Server
struct
{
...
...
@@ -138,7 +138,7 @@ func (s *Server) HandleRPC(w http.ResponseWriter, r *http.Request) {
}
RecordRequestPayloadSize
(
ctx
,
len
(
body
))
if
body
[
0
]
==
'['
{
if
IsBatch
(
body
)
{
reqs
,
err
:=
ParseBatchRPCReq
(
body
)
if
err
!=
nil
{
log
.
Error
(
"error parsing batch RPC request"
,
"err"
,
err
)
...
...
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