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

Removed adding multiple uber source request headers #551

Merged
merged 2 commits into from
Jan 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions runtime/client_http_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ func (req *ClientHTTPRequest) WriteJSON(
// Using `Add` over `Set` intentionally, allowing us to create a list
// of headerValues for a given key.
for headerKey, headerValue := range req.defaultHeaders {
httpReq.Header.Add(headerKey, headerValue)
httpReq.Header.Set(headerKey, headerValue)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is the right fix, per rfc2616 http header can have multiple values.

Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded.

This pr changes the header semantics to be single valued per header key, which is not correct by spec.

}

for k := range headers {
httpReq.Header.Add(k, headers[k])
httpReq.Header.Set(k, headers[k])
}

if body != nil {
Expand Down