Did you solve this problem? If so, could I see the code? I am trying to read the stream's priority field.
Em quarta-feira, 23 de maio de 2018 07:41:34 UTC-3, Ankit Gupta escreveu: > > I am using *golang.org/x/net/http2 <http://golang.org/x/net/http2>* and > *golang.org/x/net/http2/ > <http://golang.org/x/net/http2/>**hpack* packages to do low level http2 > framing. For requests with only HEADERS frame sent, I want to send a empy > json '{}', so I send 1 HEADERS frame and 1 DATA frame as below > > headersframe, ok := frame.(*http2.HeadersFrame) > if ok { > println("headers frame detected") > > if headersframe.StreamEnded() { > > // write HEADERS frame with 2 headers > > hbytes := make([]byte, 0, 2048) > hbuffer := bytes.NewBuffer(hbytes) > hfield1 := hpack.HeaderField{ > Name: ":status", > Value: "200", > Sensitive: false,} > hfield2 := hpack.HeaderField{ > Name: "content-type", > Value: "application/json", > Sensitive: false,} > > encoder := hpack.NewEncoder(hbuffer) > err := encoder.WriteField(hfield1) > err = encoder.WriteField(hfield2) > if err != nil { > println(err.Error()) > } > hfp := http2.HeadersFrameParam{ > StreamID: frame.Header().StreamID, > BlockFragment: hbuffer.Bytes(), > EndStream: false, > EndHeaders: true, > } > err = framer.WriteHeaders(hfp) > if err != nil { > println(err.Error()) > } > > // write DATA frame > > data := []byte("{}") > framer.WriteData(frame.Header().StreamID, true, data) > } > return > } > > On trying with *curl -v https://127.0.0.1:8000 <https://127.0.0.1:8000> > -k --http2*, I get error as - > > curl: (16) Error in the HTTP2 framing layer > > Is anything missing in my way of framing response? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/95fe40c6-090d-47d6-a46b-a2e79eac75f3%40googlegroups.com.