Skip to content

Commit

Permalink
update buffer size (stellar#948)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsachiherman authored Sep 12, 2023
1 parent 3cd84b5 commit 440aa40
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/soroban-rpc/internal/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ import (
"github.com/stellar/soroban-tools/cmd/soroban-rpc/internal/transactions"
)

// maxHTTPRequestSize defines the largest request size that the http handler
// would be willing to accept before dropping the request. The implementation
// uses the default MaxBytesHandler to limit the request size.
const maxHTTPRequestSize = 512 * 1024 // half a megabyte

// Handler is the HTTP handler which serves the Soroban JSON RPC responses
type Handler struct {
bridge jhttp.Bridge
Expand Down Expand Up @@ -275,8 +280,7 @@ func NewJSONRPCHandler(cfg *config.Config, params HandlerParams) Handler {
globalQueueRequestExecutionDurationLimitCounter,
params.Logger)

// Limit request sizes to 10MB
handler = http.MaxBytesHandler(handler, 1024*1024*10)
handler = http.MaxBytesHandler(handler, maxHTTPRequestSize)

corsMiddleware := cors.New(cors.Options{
AllowedOrigins: []string{"*"},
Expand Down

0 comments on commit 440aa40

Please sign in to comment.