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

x/net/http2: client should allow 'trailers' Transfer-Encoding header #15089

Closed
rolandshoemaker opened this issue Apr 3, 2016 · 5 comments
Closed

Comments

@rolandshoemaker
Copy link
Member

  1. What version of Go are you using (go version)?
    go1.6
  2. What operating system and processor architecture are you using (go env)?
    Ubuntu 15.10 amd64
  3. What did you do?
package main

import (
    "log"
    "net/http"
)

func main() {
    // Enables HTTP/2 in the DefaultClient on Go 1.6.0
    if tr, ok := http.DefaultTransport.(*http.Transport); ok {
        tr.ExpectContinueTimeout = 0
    }
    req, err := http.NewRequest("GET", "https://www.google.com", nil)
    if err != nil {
        log.Fatal(err)
    }
    req.Header.Set("Transfer-Encoding", "trailers")
    _, err = http.DefaultClient.Do(req)
    if err != nil {
        log.Fatal(err)
    }
}
  1. What did you expect to see?
    No error
  2. What did you see instead?
    http2: invalid Transfer-Encoding request header.

checkConnHeaders fails on any Transfer-Encoding header values other than chunked, but encodeHeaders ignores any Transfer-Encoding headers anyway. This is contrary to the spec which says

The only exception to this is the TE header field, which MAY be present in an HTTP/2 request; when it is, it MUST NOT contain any value other than "trailers".

@bradfitz
Copy link
Contributor

bradfitz commented Apr 3, 2016

TE and Transfer-Encoding are different headers:

http://tools.ietf.org/html/rfc7230#section-4.3 (TE)
http://tools.ietf.org/html/rfc7230#section-3.3.1 (Transfer-Encoding)

@rolandshoemaker
Copy link
Member Author

Confusing names are confusing, my bad!

@bradfitz
Copy link
Contributor

bradfitz commented Apr 3, 2016

No prob. Thanks for fixing the other one.

@rolandshoemaker
Copy link
Member Author

Now that I look checkConnHeaders should probably be checking TE == ("trailers" || "")?

@bradfitz
Copy link
Contributor

bradfitz commented Apr 3, 2016

Yeah, looks like it.

@golang golang locked and limited conversation to collaborators Apr 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants