Comments (6)
from envoy.
Also, looks to me like onStatus is returning the reason phrase, not the status code? rename or fix is in order?
from envoy.
Also, looks to me like onStatus is returning the reason phrase, not the status code? rename or fix is in order?
That is correct. This is pre-existing from before BalsaParser was added. What makes most sense to me is to lump fixing this with other cleanup tasks in the far future when http-parser gets removed.
from envoy.
During UpstreamHttp11ConnectSocket::isValidConnectResponse(), a framer is used under the hood to parse the header. Later its statusCode() is used to determine validity.
However, when the response header contains
content-length: 0
, BalsaParser::MessageDone() will be invoked which purges the parsed header. Later when statusCode() is called, since the header is empty, the default 0 status code is returned and the response is mistaken as invalid.This bug is sneaky because when
content-length
isn't present, the framer will wait to read more data until the connection close, and thus MessageDone() is never called.I think the correct fix should be to not reset the header when the framer is cleared, because the header is owned by the BalsaParser.
Thank you for raising this issue.
I don't think the right approach is to not reset BalsaHeaders along with BalsaFrame. BalsaParser is designed to parse multiple messages, so it makes sense to reset BalsaHeaders and BalsaFrame at the same time. I propose saving the value of the status code when the headers are parsed, and keeping it either until the first byte of the next message is parsed, or as long as possible, until the headers of the next message are parsed.
Another approach would be not to reset BalsaFrame and BalsaHeaders when parsing the message is complete. I think as long as we only need access to a single integer, it is better to reset them early, because they take up memory, but this would also be a viable approach if more state would need to be accessed.
from envoy.
is it just the single integer? looks like isHttp11 also refers to headers, as does contentLength and possibly others (I stopped at n=2). I think it'd be safer to keep headers around rather than trying to latch all of the fields and hope we don't forget to do so in future.
from envoy.
is it just the single integer? looks like isHttp11 also refers to headers, as does contentLength and possibly others (I stopped at n=2). I think it'd be safer to keep headers around rather than trying to latch all of the fields and hope we don't forget to do so in future.
Oh thanks, that's a very good point.
from envoy.
Related Issues (20)
- New CEL convenience function: random() HOT 5
- Newer release available `com_github_c_ares_c_ares`: v1.31.0 (current: cares-1_20_1)
- Perf issue with c-ares DNS resolver HOT 2
- Control Weighted Cluster Weights via Runtime config
- Question about request_mirroring#disable_shadow_host_suffix_append HOT 2
- Garbled characters are displayed when setting cookie attribute HOT 1
- Qus: Does envoy support connecting to upstream Redis with TLS enabled? HOT 2
- Newer release available `com_github_zlib_ng_zlib_ng`: 2.1.7 (current: 2.0.7)
- Newer release available `io_bazel_rules_go`: v0.48.1 (current: v0.46.0)
- Newer release available `rules_python`: 0.33.2 (current: 0.32.2)
- CONNECT-UDP in forwarding proxy mode resets stream and fails to send HTTP Datagrams HOT 1
- Regarding use of envoy api along with envoy api dependencies HOT 1
- Newer release available `com_github_wasmtime`: v22.0.0 (current: v9.0.3)
- ext_proc: should return 504 on timeout error HOT 1
- Does envoy supports configuring upstream application layer protocol? HOT 1
- Clean up Stats header import of MemoryTest
- Newer release available `aspect_bazel_lib`: v2.7.8 (current: v2.7.7)
- Newer release available `com_github_bufbuild_buf`: v1.34.0 (current: v1.32.2)
- Newer release available `com_github_datadog_dd_trace_cpp`: v0.2.2 (current: v0.2.1)
- Newer release available `io_opentelemetry_cpp`: v1.16.0 (current: v1.14.2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from envoy.