Skip to content

fix: improve CURLRequest intermediate HTTP response handling - #9627

Merged
michalsn merged 1 commit into
codeigniter4:developfrom
michalsn:fix/curl-request-response
Jul 10, 2025
Merged

fix: improve CURLRequest intermediate HTTP response handling#9627
michalsn merged 1 commit into
codeigniter4:developfrom
michalsn:fix/curl-request-response

Conversation

@michalsn

Copy link
Copy Markdown
Member

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

@michalsnmichalsn 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:developJul 10, 2025
@michalsn

Copy link
Copy Markdown
MemberAuthor

Thank you @paulbalandan

@michalsn
michalsn deleted the fix/curl-request-response branch July 14, 2025 06:45
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugVerified 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

@michalsn@paulbalandan