wwbmmm opened a new pull request, #3382:
URL: https://github.com/apache/brpc/pull/3382
### What problem does this PR solve?
Issue Number: null
Problem Summary:
Some HTTP, memcache, and couchbase parsing paths did not consistently enforce
the global `max_body_size` setting. Non-progressive HTTP messages could
buffer
more data than configured, while memcache and couchbase parsers could wait
for
an oversized body declared in a response header.
### What is changed and the side effects?
Changed:
- Track the accumulated body size of non-progressive HTTP messages and reject
data before appending beyond `max_body_size`.
- Return HTTP 413 for oversized HTTP/1 requests and close the connection
after
writing the response.
- Reset only the oversized HTTP/2 stream with `ENHANCE_YOUR_CALM`.
- Reject oversized memcache and couchbase responses immediately after parsing
their fixed-size headers.
- Add regression tests for fixed-length HTTP, chunked HTTP, memcache, and
couchbase messages.
Side effects:
- Performance effects: Each non-progressive HTTP body block adds one
overflow-safe size comparison and addition. Memcache and couchbase add one
comparison per response. No additional scan, allocation, or copy is added.
- Breaking backward compatibility: Messages larger than `max_body_size` are
now rejected as documented. Progressive HTTP reading remains unchanged so
existing bounded-memory streaming transfers can exceed this setting.
### Check List:
- [x] The changes are compilable.
- [x] Regression tests are included.
- [x] The affected test suites pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]