nodece opened a new pull request, #25211:
URL: https://github.com/apache/pulsar/pull/25211
### Motivation
Although PulsarAdmin (`async-http-client` based) does not send the "Expect:
100-continue" header by default, we observed in production that some clients
(like curl or other HTTP clients) do use it when uploading large packages
through the proxy.
Requests with this header could cause Early EOF issues when the proxy
forwards the request to the broker. The proxy should handle or filter this
header to maintain compatibility and prevent connection errors.
### Modifications
**Proxy package upload and HTTP header handling:**
* Added logic in `AdminProxyHandler` to detect requests with the
"Expect: 100-continue" header and wrap them using
`NoExpectRequestWrapper`, ensuring the header is not forwarded to the
broker and preventing Early EOF.
* Introduced the `NoExpectRequestWrapper` inner class to filter out the
"Expect" header from incoming requests.
**Testing and validation:**
* Added `ProxyPackagesUploadTest` to verify package upload and download
through the proxy, including large file uploads and "Expect: 100-continue"
scenarios.
* Added test dependency on the `pulsar-package-core` test-jar to enable
usage of mock package storage in proxy tests.
**Mocked package storage improvements:**
* Refactored `MockedPackagesStorage` to read input streams in chunks
using a buffer and `ByteArrayOutputStream`, supporting large file uploads
and avoiding previous issues.
* Added `MockedPackagesStorageTest` to validate correctness of write and
read operations for large files in mock storage.
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update
later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
--
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]