简体   繁体   中英

How to read http2 pseudofields

I have an http2 handler and it received http2 requests. Now I need to access:authority pseudoheader field in the request. How to go about it? I am aware of few options as below:

  1. Hijack the http connection -> But I do not want to lose the http layer capabilities, it's really an overkill. All I need is just the value of that pseudo header field.
  2. Get the underlying tcp conn without hijacking it and read the frames from it. -> Now, how to do this? One way could be to get the tcp conn in http.Server.ConnState (but there is no guarantee with this I think. I quite often find that the connection is closed and in any case i find it very cumbersome).

Is there a way, to just extract the pseudofield alone?

the Host in http.Request does it in the sense that, it reads the:authority into r.Host field. But other fields are difficult to get a hold of.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM