summaryrefslogtreecommitdiff
path: root/src/daq
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2016-10-13 18:55:22 +0200
committerChristian Pointner <equinox@spreadspace.org>2016-10-13 18:55:22 +0200
commit417f38ca3cb7bb38acc1eea603df694e0ed89a2c (patch)
tree135007c345c9552c8bc248fa70a751e1a99a9940 /src/daq
parentmake header operations more flexible... needs testing (diff)
some fixes in new config file format
Diffstat (limited to 'src/daq')
-rw-r--r--src/daq/s5proxy/sample.json7
-rw-r--r--src/daq/s5proxy/src/s5proxy/config.go9
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 {