aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/http.go
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2018-09-25 22:57:31 +0800
committerJanos Guljas <janos@resenje.org>2018-09-25 22:57:31 +0800
commit24349144b6c0642755569268bab56b9033743212 (patch)
tree9d9d2b6659fd8a56512dfc807aafe4b733165ae1 /rpc/http.go
parent7d56602391e155e2ce9ba7c261300a1804ab9972 (diff)
parentd3441ebb563439bac0837d70591f92e2c6080303 (diff)
downloaddexon-24349144b6c0642755569268bab56b9033743212.tar
dexon-24349144b6c0642755569268bab56b9033743212.tar.gz
dexon-24349144b6c0642755569268bab56b9033743212.tar.bz2
dexon-24349144b6c0642755569268bab56b9033743212.tar.lz
dexon-24349144b6c0642755569268bab56b9033743212.tar.xz
dexon-24349144b6c0642755569268bab56b9033743212.tar.zst
dexon-24349144b6c0642755569268bab56b9033743212.zip
Merge branch 'master' into max-stream-peer-servers
Diffstat (limited to 'rpc/http.go')
-rw-r--r--rpc/http.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/rpc/http.go b/rpc/http.go
index f3bd1f29c..af79858e2 100644
--- a/rpc/http.go
+++ b/rpc/http.go
@@ -37,7 +37,7 @@ import (
const (
contentType = "application/json"
- maxRequestContentLength = 1024 * 128
+ maxRequestContentLength = 1024 * 512
)
var nullAddr, _ = net.ResolveTCPAddr("tcp", "127.0.0.1:0")
@@ -238,6 +238,12 @@ func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ctx = context.WithValue(ctx, "remote", r.RemoteAddr)
ctx = context.WithValue(ctx, "scheme", r.Proto)
ctx = context.WithValue(ctx, "local", r.Host)
+ if ua := r.Header.Get("User-Agent"); ua != "" {
+ ctx = context.WithValue(ctx, "User-Agent", ua)
+ }
+ if origin := r.Header.Get("Origin"); origin != "" {
+ ctx = context.WithValue(ctx, "Origin", origin)
+ }
body := io.LimitReader(r.Body, maxRequestContentLength)
codec := NewJSONCodec(&httpReadWriteNopCloser{body, w})