Skip to content

Upd. Cleantalk.php. Rotate moderate. Now use CURLOPT_RESOLVE for IP instead of converting IP as string if IP is used as fallback. - #894

Open
alexandergull wants to merge 2 commits into
devfrom
curlopt_resolve.ag
Open

alexandergull wants to merge 2 commits into
devfrom
curlopt_resolve.ag

Conversation

@alexandergull

Copy link
Copy Markdown
Member

@alexandergull alexandergull changed the title Upd. Cleantalk.php. Rotate moderate. Now use CURLOPT_RESOLVE for IP instead of converting IP as string if IP is used as fallback. https://app.doboard.com/1/task/55885 Upd. Cleantalk.php. Rotate moderate. Now use CURLOPT_RESOLVE for IP instead of converting IP as string if IP is used as fallback. Sep 21, 2026
@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.85714% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.78%. Comparing base (968b546) to head (ad134bb).
⚠️ Report is 2 commits behind head on dev.

Files with missing lines Patch % Lines
lib/Cleantalk/Antispam/Cleantalk.php 82.85% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #894      +/-   ##
============================================
+ Coverage     30.59%   30.78%   +0.18%     
- Complexity     6639     6663      +24     
============================================
  Files           292      292              
  Lines         26493    26532      +39     
============================================
+ Hits           8105     8167      +62     
+ Misses        18388    18365      -23     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved critical and moderate issues affect fallback correctness and runtime safety.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Updates moderate-server fallback requests to use CURLOPT_RESOLVE while preserving hostname-based TLS verification.

Changes:

  • Adds hostname-to-IP resolution with default and explicit ports.
  • Updates fallback retry behavior.
  • Adds regression tests for resolution, TLS, and invalid inputs.

Review findings:

  • CURLOPT_RESOLVE needs a defined-constant guard.
  • DNS failure classification does not reach the new fallback in common cases.
  • The fallback must preserve $url_host rather than using the PTR hostname.
File Summary
tests/​Antispam/​TestCleantalkResolveIP.php Adds regression tests for mappings, ports, TLS, and invalid inputs.
lib/​Cleantalk/​Antispam/​Cleantalk.php Implements IP-pinned fallback requests and retry behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/Cleantalk/Antispam/Cleantalk.php Outdated
Comment thread lib/Cleantalk/Antispam/Cleantalk.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved production TLS/SNI and fallback-handling issues remain, along with a regression test that asserts unsafe behavior.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (2)

Comment thread lib/Cleantalk/Antispam/Cleantalk.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Address the unavailable CURLOPT_RESOLVE guard and legacy URL handling when no valid IP is present.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (1)

// CURLOPT_RESOLVE is a cURL option, the WordPress HTTP API silently drops it.
// Without it the hostname would be resolved by DNS again and the node
// selection would be lost, so force the cURL transport for pinned requests.
$http_api_state = $this->disableBuiltInHttpApi(isset($options[CURLOPT_RESOLVE]));

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants