Validate prefix lookups for WithRequest/WithResponse contexts

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2015-03-12 19:09:26 -07:00
parent ddde6b4363
commit 77dc35fbd6

View file

@ -133,6 +133,10 @@ func (ctx *httpRequestContext) Value(key interface{}) interface{} {
return ctx.r return ctx.r
} }
if !strings.HasPrefix(keyStr, "http.request.") {
goto fallback
}
parts := strings.Split(keyStr, ".") parts := strings.Split(keyStr, ".")
if len(parts) != 3 { if len(parts) != 3 {
@ -241,6 +245,10 @@ func (irw *instrumentedResponseWriter) Value(key interface{}) interface{} {
return irw.ResponseWriter return irw.ResponseWriter
} }
if !strings.HasPrefix(keyStr, "http.response.") {
goto fallback
}
parts := strings.Split(keyStr, ".") parts := strings.Split(keyStr, ".")
if len(parts) != 3 { if len(parts) != 3 {