diff options
Diffstat (limited to 'src/daq/s5proxy')
-rw-r--r-- | src/daq/s5proxy/sample.json | 7 | ||||
-rw-r--r-- | src/daq/s5proxy/src/s5proxy/config.go | 9 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/daq/s5proxy/sample.json b/src/daq/s5proxy/sample.json index 7f5ac66..92737fa 100644 --- a/src/daq/s5proxy/sample.json +++ b/src/daq/s5proxy/sample.json @@ -3,10 +3,9 @@ "connect": "http://emc01.spreadspace.org:8000", "cert": "fullchain.pem", "key": "private.key", - "request_header": { - "X-hello": "world", - "X-verr": "stefan" - }, + "request_header": [ + { "op": "del", "header": "X-Forwarded-For" } + ], "response_header": [ { "op": "set", "header": "Cache-Control", "value": "no-cache" }, { "op": "add", "header": "Cache-Control", "value": "no-store" }, diff --git a/src/daq/s5proxy/src/s5proxy/config.go b/src/daq/s5proxy/src/s5proxy/config.go index ec7e467..09fad61 100644 --- a/src/daq/s5proxy/src/s5proxy/config.go +++ b/src/daq/s5proxy/src/s5proxy/config.go @@ -34,6 +34,7 @@ package main import ( "encoding/json" + "errors" "os" ) @@ -65,6 +66,8 @@ func (o *Operation) fromString(str string) (err error) { *o = OpDel case "set": *o = OpSet + default: + return errors.New("invalid operation: '" + str + "'") } return } @@ -74,14 +77,14 @@ func (o Operation) MarshalText() (data []byte, err error) { return } -func (o *Operation) UnmarshalJSON(data []byte) (err error) { +func (o *Operation) UnmarshalText(data []byte) (err error) { return o.fromString(string(data)) } type HeaderOperation struct { - Header string `json:"header"` - Value string `json:"value"` Operation Operation `json:"op"` + Header string `json:"header"` + Value string `json:"value,omitempty"` } type Config struct { |