Issue-3364: Reproduction + fix(Proposal )#3693
Issue-3364: Reproduction + fix(Proposal )#3693rajanyadav0307 wants to merge 1 commit intoaws:mainfrom
Conversation
Sign-off: Rajan Y.(rajanyadav0307@gmail.com)
1016765 to
aba6838
Compare
|
@sbiscigl , Thanks |
|
Please can you review this change? Thanks |
|
@rajanyadav0307 Thanks for the detail report and code update, I was able to verify the fix worked as you intended. Could you extend this fix to the other HTTP client as well? |
|
@kai-ion Sure I will extend this fix to the other HTTP client as well. |
aba6838 to
288655e
Compare
|
Thanks @kai-ion for taking a look and confirming the CurlHttpClient fix. For this PR, I’ve focused on extending the same behavior to CRTHttpClient, aligning it with CurlHttpClient’s handling of response output streams: 1. Avoid assuming the response stream is seekable I’ve verified that the CRT path already tracks bytes received via the transport callbacks, so no position-based querying is required there, and the fix is limited to improving write/flush error handling consistency. While reviewing this, I also noticed that IXmlHttpRequest2HttpClient follows a very similar pattern (stream writes via a sequential adapter and an unconditional final flush). It would benefit from the same defensive checks and error propagation for non-seekable or filtering streams. I intentionally did not include that change in this PR to keep the scope tight and focused on Curl + CRT parity. If you’re comfortable with the CRT approach here, I’m happy to extend the same pattern to IXmlHttpRequest2HttpClient in a follow-up (or in this PR if you prefer). Please let me know how you’d like to proceed. |
|
@kai-ion , Thanks |
|
Thanks for your PR. Lets try to scope the changes down here. The original issue was that the call to |
|
Thanks @sbaluja for bringing here. From my understanding, I don't see other HTTP clinet using tellp() other than CurlHttpClient. So, this brings us to the change related to only CurlHttpClient changes. I will make the PR just addressing for the CurlHttpClient. |
288655e to
6f08e2e
Compare
|
@sbaluja , Thanks. |
| { | ||
| }; | ||
|
|
||
|
|
There was a problem hiding this comment.
Is this required? I believe we have other curl specific tests in this suite already.
There was a problem hiding this comment.
Thanks @sbaluja ,
The reason for adding this was because I encounter errors for CURLHttpClientTest:
#7 216.0 /work/aws-sdk-cpp/tests/aws-cpp-sdk-core-tests/http/HttpClientTest.cpp:370:8: error: 'CURLHttpClientTest' was not declared in this scope; did you mean 'HttpClientTest'? #7 216.0 370 | TEST_F(CURLHttpClientTest, TestHttpRequestWorksFine)
:
:
All other CURLHttpClientTest.
I have explicitly compiled the core component, and tried to ran the core-test.
Dockerfile:
|
Thanks for the update. Have you tested what the behavior of non-seekable streams is for the other http clients? The test you've written is currently only for the curl client. If the behavior is the same across the clients, this test should be written similar to other tests in the suite that use different clients based on platform. Let me know. |
|
@sbaluja , Please point out, if I need to change anything while compile and running. My build steps:
Couple of things I would like to bring:
If you want me to adopt any other plan, please let me know. I would be happy to align accordingly. |
Issue #, if available:
Issue-3364: Fix Proposal
Description of changes:
This PR fixes an issue in
CurlHttpClient::WriteDatawhere querying the output position of the response body stream could cause the HTTP transfer to abort when the stream does not support positioning (e.g.,boost::iostreams::filtering_streamwith compression/decompression filters).Problem
The existing implementation attempted to query the current write position of the response body stream using positioning APIs (
tellp()/ seek operations) for diagnostic purposes. For non-seekable output streams, this operation may fail and set the stream into a bad state, which caused the SDK to treat the write as a fatal error and abort the transfer, even though the actualwrite()operation itself was valid and succeeded.This behavior is expected for certain stream types and should not be treated as a write failure.
Fix
m_numBytesResponseReceived) for accurate response size tracking.This change improves compatibility with clients that use non-seekable or filtering output streams without altering public APIs or behavior for existing seekable stream use cases.
Check all that applies:
(Added a regression test guarded by
ENABLE_HTTP_CLIENT_TESTINGthat validates non-seekable response streams do not abort transfers. This follows the existing CurlHttpClient test pattern and requires the local dummy HTTP server for execution.)Platforms verified:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Sign-off:
Rajan Y. (rajanyadav0307@gmail.com)