Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass on headers from original request. #37

Merged
merged 4 commits into from
Dec 9, 2016
Merged

Conversation

rokkbert
Copy link
Contributor

@rokkbert rokkbert commented Dec 8, 2016

The Host header, which is automatically deleted by go, is restored and, together with the other headers from the original request, is passed on to the FetchDefinitions.
That way we can make caching decisions based on the host, for services that handle more than one host, with same paths but different content.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 92.926% when pulling c0ee0d2 on CachingSeparatedByHost into 4849120 on master.

@@ -99,7 +99,9 @@ func (tcs *CacheStrategy) HashWithParameters(method string, url string, requestH
}
}

return hex.EncodeToString(hasher.Sum(nil))
hash := hex.EncodeToString(hasher.Sum(nil))
// logging.Logger.Error("HASH = " + hash + ", url = " + url + ", host = " + requestHeader.Get("Host"))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove ..

// Jira 3946: go deletes the "Host" header from the request (for whatever reasons):
// https://golang.org/src/net/http/request.go:
// 123 // For incoming requests, the Host header is promoted to the
// 124 // Request.Host field and removed from the Header map.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't understand the number 123, 124

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's just the copy&pasted line numbers from request.go

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, understand now.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.09%) to 92.922% when pulling d7f166c on CachingSeparatedByHost into 4849120 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.7%) to 92.132% when pulling c0a802f on CachingSeparatedByHost into 4849120 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 92.93% when pulling 5cef6d6 on CachingSeparatedByHost into 4849120 on master.

@rokkbert rokkbert merged commit 04a1ee5 into master Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants