proxy interceptors implicitly modify arguments, instead of returning them

This commit is contained in:
Paul Bellamy committed 2015-05-19 10:34:46 +01:00
1 parent 126d4f4079
commit 2f8c5d7bd9
4 files changed
+26 -26

No files matched your search

+8 -8
View File
@@ -16,15 +16,15 @@ type startContainerInterceptor struct {
withDNS bool
}
func (i *startContainerInterceptor) InterceptRequest(r *http.Request) (*http.Request, error) {
return r, nil
func (i *startContainerInterceptor) InterceptRequest(r *http.Request) error {
return nil
}
func (i *startContainerInterceptor) InterceptResponse(r *http.Response) (*http.Response, error) {
func (i *startContainerInterceptor) InterceptResponse(r *http.Response) error {
containerID := ""
if subs := containerIDRegexp.FindStringSubmatch(r.Request.URL.Path); subs == nil {
Warning.Printf("No container id found in request with path %s", r.Request.URL.Path)
return r, nil
return nil
} else {
containerID = subs[1]
}
@@ -32,13 +32,13 @@ func (i *startContainerInterceptor) InterceptResponse(r *http.Response) (*http.R
container, err := i.client.InspectContainer(containerID)
if err != nil {
Warning.Printf("Error inspecting container %s: %v", containerID, err)
return r, nil
return nil
}
cidrs, ok := weaveCIDRsFromConfig(container.Config)
if !ok {
Debug.Print("No Weave CIDR, ignoring")
return r, nil
return nil
}
Info.Printf("Container %s was started with CIDR \"%s\"", containerID, strings.Join(cidrs, " "))
args := []string{"attach"}
@@ -46,7 +46,7 @@ func (i *startContainerInterceptor) InterceptResponse(r *http.Response) (*http.R
args = append(args, containerID)
if _, err := callWeave(args...); err != nil {
Warning.Printf("Attaching container %s to weave failed: %v", containerID, err)
return r, nil
return nil
}
return r, nil
return nil
}