Browse Source

Merge pull request #136 from thaJeztah/18.09_backport_fix_panic

[18.09 engine] registry: use len(via)!=0 instead of via!=nil
Andrew Hsu 6 years ago
parent
commit
01c732d40a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      registry/registry.go

+ 1 - 1
registry/registry.go

@@ -145,7 +145,7 @@ func trustedLocation(req *http.Request) bool {
 // addRequiredHeadersToRedirectedRequests adds the necessary redirection headers
 // for redirected requests
 func addRequiredHeadersToRedirectedRequests(req *http.Request, via []*http.Request) error {
-	if via != nil && via[0] != nil {
+	if len(via) != 0 && via[0] != nil {
 		if trustedLocation(req) && trustedLocation(via[0]) {
 			req.Header = via[0].Header
 			return nil