-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add support for http trailers and full range keys #66
Comments
I referenced some upstream issues on fasthttp as at some point it would be nice for these to be in the standard library underneath as well. Regardless, we'll need apis here as otherwise when people access code, they are reliant on the implementation of fasthttp, not the types and functions defined explicitly here: valyala/fasthttp#1400 cc @li-jin-gou |
mosn filter's API already provide accessibility to http header/body/trailer
you can simple put the header/body/trailer in the filter(ctx) and get them whenever you need |
@antJack ok I think there are a couple things then. one is that fasthttp doesn't work with trailers, yet. mosn/mosn#2145 (comment) When we update here, we need a different type for trailers because in fasthttp trailers are in the same requestheaders type as headers. If we don't handle that here, then mosn will need similar logic to do it. valyala/fasthttp#1165 There's a separate topic about access for GetAllKeys and GetAll, but let's talk about ^^ first. |
ok, after reading those materials, I probably understand what you want to do. If there is any idea about where to add those trailers-related api? Another problem is that whether mosn should also "implements trailing headers as a part of the http request and response headers", since mosn's api is not just for http. |
My first thought was to add the extra apis to the existing http request/response types here https://github.com/mosn/pkg/blob/master/protocol/http/types.go another way could be to define new types RequestTrailers and ResponseTrailers, if that's easier to integrate with the existing mosn callbacks. either way, it would be http only. wdyt? |
I will work on an implementation, as after we should cut a version of api, pkg so that mosn/holmes#129 and then eventually dapr can have api/pkg version alignment |
We may prefer not changing the top-level stream filter api, such as:
just keeps the separation of headers/trailers, they were designed not only for http, and not even for fasthttp. and it's ok to define new types RequestTrailers and ResponseTrailers in pkg/protocol/http, and finally integrate with fasthttp in pkg/stream/http |
sounds good. My plan was that even if the ResponseTrailers type is backed by fasthttp RequestHeaders one, the call sites don't change. I think we are eye-to-eye! |
@antJack there are a few glitches we'll run into with fasthttp because the trailers are comingled with the headers. For example, logic like this either needs to be inaccurate or filter out the trailer keys
Same issue in range really. I have no issue doing the filtering meanwhile (Ex. inspect to see if a header key is a trailing one and filter it out plus visa versa). p.s. I'm not sure this is the right byte size? Is it supposed to be the text encoded size? if so, I think we need colons at least if not colon space? Maybe we can go back and document ByteSize more specifically? or should we just drop it.. wdyt? |
just keep it simple, the most common usage scenarios of seems that byte size should account for colons, ref: https://github.com/envoyproxy/envoy/blob/main/source/common/http/header_map_impl.cc#L250 |
thanks for the advice @antJack! |
sorry i said it wrong yesterday byte size should not account for colons |
@antJack I think maybe it is a good idea to release api and pkg just the version updates before I do this change. Then after we can follow-up and make improvements indepedent of go+fasthttp. wdyt? |
cc @taoyuanyuan on ^^ basically I think safest way is to tag api/pkg before I change any logic in it, mainly to adjust for vendoring go 1.18 and fasthttp version update. then roll that through, and after this go back and change logic. |
when next fasthttp comes out (v1.42.0), we can revisit this valyala/fasthttp#1405 |
1.42 is out |
fasthttp implements trailing headers as a part of the http request and response headers objects. To ensure we can use these without relying on fasthttp API, we need a few more functions, which I'm happy to implement after #65 is in. I need this to help support the new http-wasm host, which has glitches both in trailers and also multiple header values.
cc @taoyuanyuan I'll backfill unit tests and polish up stuff, but probably this should be done separate from the version bump
The text was updated successfully, but these errors were encountered: