Skip to content

Conversation

michalsn
Copy link
Member

@michalsn michalsn commented Jul 6, 2025

Description
This PR fixes a bug in CURLRequest where intermediate HTTP responses were not properly removed from the response chain in certain scenarios, causing incorrect status codes and headers to be returned instead of the final response.

The problem was that the original logic processed different types of intermediate responses separately, which could miss responses that appeared in mixed order.

  • Refactored send() method to use unified intermediate response removal
  • Removed handleRedirectHeaders() private method
  • Added removeIntermediateResponses() and shouldRemoveCurrentResponse() private methods, which now handle the entire process of intermediate headers removal

The issue was reported on the forum: https://forum.codeigniter.com/showthread.php?tid=93094&pid=426075#pid426075

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn added the bug Verified issues on the current code behavior or pull requests that will fix them label Jul 6, 2025
@michalsn michalsn merged commit ff04e9e into codeigniter4:develop Jul 10, 2025
50 checks passed
@michalsn
Copy link
Member Author

Thank you @paulbalandan

@michalsn michalsn deleted the fix/curl-request-response branch July 14, 2025 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants