Closed anlowee closed 2 weeks ago
The changes involve modifications to the CurlDownloadHandler
and NetworkReader
classes to support custom HTTP headers during download requests. The constructors of both classes have been updated to include a new optional parameter for HTTP headers, which is processed and validated. Additionally, new test cases have been introduced to ensure the correct handling of valid and invalid HTTP headers. The updates maintain existing functionalities while enhancing the ability to customize HTTP requests.
File | Change Summary |
---|---|
components/core/src/clp/CurlDownloadHandler.cpp |
- Constructor updated to include http_header_kv_pairs parameter for custom HTTP headers.- Logic added to process headers, check for reserved headers, and throw exceptions if necessary. - Updated header appending logic. |
components/core/src/clp/CurlDownloadHandler.hpp |
- Added include statements for <optional> and <unordered_map> .- Constructor signature updated to include http_header_kv_pairs with documentation reflecting this change. |
components/core/src/clp/NetworkReader.cpp |
- Constructor updated to include http_header_kv_pairs parameter.- DownloaderThread constructor modified to accept the new parameter.- Adjustments made to curl_write_callback for better data handling. |
components/core/src/clp/NetworkReader.hpp |
- Constructor signature updated to include http_header_kv_pairs .- DownloaderThread constructor modified to accept http_header_kv_pairs . |
components/core/tests/test-NetworkReader.cpp |
- Added test cases for valid and illegal HTTP header key-value pairs to validate header handling in NetworkReader .- Included necessary headers for new test cases. |
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Description
Modified constructors of
NetworkReader
,DownloaderThread
andCurlDownloadHandler
to support custom headers passed by users.Note that this PR is the same as #564 , which was messed by a newbie contributor.
Validation performed
Added the Authorization header with a Bearer token to fetch a file from remote, validating the response.
Summary by CodeRabbit
New Features
CurlDownloadHandler
andNetworkReader
classes to support custom HTTP headers in download requests.Bug Fixes
Tests