File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ import (
32
32
var (
33
33
timeout = time .Second * 45
34
34
ProxyHTTPService = "http_proxy"
35
+
36
+ // Note: UserForwardPayloadLength should match the same value passed to genconfig.
37
+ UserForwardPayloadLength = 30000
35
38
)
36
39
37
40
func sendRequest (thin * thin.ThinClient , payload []byte ) ([]byte , error ) {
@@ -175,6 +178,15 @@ func (s *Server) Handler(w http.ResponseWriter, req *http.Request) {
175
178
panic (err )
176
179
}
177
180
181
+ // FIXME: resolve with multi-packet transimssion to transcend payload size limitation
182
+ // While better solution is developing, pre-emptively reject oversized payloads
183
+ size := len (blob )
184
+ if size > UserForwardPayloadLength {
185
+ s .log .Errorf ("(WIP) Rejecting message with oversized payload: %d > %d bytes" , size , UserForwardPayloadLength )
186
+ http .Error (w , "custom 500" , http .StatusInternalServerError )
187
+ return
188
+ }
189
+
178
190
rawReply , err := sendRequest (s .thin , blob )
179
191
if err != nil {
180
192
s .log .Errorf ("Failed to send message: %s" , err )
You can’t perform that action at this time.
0 commit comments