-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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/hpack: Write customer-header into HPACK byName Map rather than byNameValue #20574
Comments
Sorry, I don't really understand the problem so I don't understand how your proposal to modify internal code helps. Are you asking for new API, or is this purely an optimization request? Do you have a self-contained minimal example program to demonstrate the issue? /cc @tombergan |
@bradfitz Sorry for my poor description.
both name (mw-st) and value (1496630402035) will add into name will insert into
and value which change per response also indexing
which make Is it possiable for new API seperated |
There were changes to the hpack code recently, I think affecting the code you're talking about. Can you try Go tip? Or using golang.org/x/net/http2 directly, instead of the version bundled into std? |
@bradfitz I use x/net/http2 directly as vendor already since I customized the gRPC and don't want to change x/net/http2 lib behavior privately : p |
Please give us a complete Go program demonstrating the problem from a user's perspective, without referencing hpack internals. |
I think I mostly understand the request: HPACK has a dynamic table that is a list of "header fields", where each header field is a name/value pair. Suppose we have the following sequence of header fields:
In HPACK, the first field could be encoded as in Figure 7, the second field could use an index to the first field's name as in Figure 6, and the third field could use an index to the second field's name/value pair as in Figure 5 (https://tools.ietf.org/html/rfc7541#section-6.2.1). Go's HPACK library already does this. I believe @Zeymo is asking for an additional feature: In the above case, we know that duplicate In any case, this would be simple to support if we wanted to: add a boolean field |
A shorter-term option is to set |
@tombergan absolutely right. Although filed like |
What about adding the ability to control which headers are set a type Transport struct {
...
SensitiveHeader func(h hpack.HeaderField) bool
} This function would be called by This would give the opportunity to define which header values should be indexed or not. Always returning true, would disable name/value indexing altogether as requested by @Zeymo. Typical use-case for this is when the building a gateway that can multiplex requests from different users to the same backend connection. In this context, unique per-user headers like |
Change https://golang.org/cl/154917 mentions this issue: |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.8
What operating system and processor architecture are you using (
go env
)?What did you do?
we use http2 as gateway platform protocol and extension header like
mw-xxx
to do some gateway sub-protocl as request and response.as some resposne header, "mw-server-time" or "mw-rt", which has static name and dynamic value per request ,accordding to HPACK,these entry will add dynamic table like below
and which take 23% alloc_objects and much map hash grow in pprof
What did you expect to see?
we want only use byName map to index name rather than indexing name-value
and never indexing
seperate addEntry such as blew
and also
table.search
The text was updated successfully, but these errors were encountered: