Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cURL incompatibility with Kaspersky (kesl) #656

Open
1 task
mircobabini opened this issue Dec 6, 2021 · 2 comments · Fixed by #657
Open
1 task

cURL incompatibility with Kaspersky (kesl) #656

mircobabini opened this issue Dec 6, 2021 · 2 comments · Fixed by #657

Comments

@mircobabini
Copy link
Contributor

Summary

I'm facing an issue with some servers having kesl service (Kaspersky) installed and running.

Sometimes wp_remote_* calls fails with error:

Scaricamento del pacchetto di installazione da https://downloads.wordpress.org/plugin/jetpack.10.1.zip...
Warning: Il download non è andato a buon fine. "cURL error 18: transfer closed with 332690 bytes remaining to read"

The number of bytes is completely randomic.
Since it's not consistent, I've prepared this script to be run over and over (without wp-cli cache of course):

while :; do  wp plugin install jetpack && wp plugin delete jetpack && rm -rf /root/.wp-cli/cache/*; done

After digging a lot into WpOrg\Requests\Transport\cURL implementation I've found these lines being the cause of the issue:

<?php
// Force closing the connection for old versions of cURL (<7.22).
if (!isset($headers['Connection'])) {
        $headers['Connection'] = 'close';
}

Disabling these lines, the issue disappear. Why aren't we checking the cURL version here?
I would then suggest these changes:

  1. Add a new const const CURL_7_22_0 = 0x071600
  2. Check the version and add that header only if needed

Your environment

Environment Answer
Operating system and version (e.g. Ubuntu 20.04, CentOS, tried both)
PHP version 7.4 (tried others as well)
Requests version provided with WordPress latest
Autoloader used WordPress
Link to your project into a vpn, not accessible through the internet

Tested against develop branch?

  • I have verified the issue still exists in the develop branch of Requests.
@mircobabini
Copy link
Contributor Author

As reported here: https://core.trac.wordpress.org/ticket/54588

@jrfnl
Copy link
Member

jrfnl commented Nov 8, 2023

FYI: A patch for this issue was included in the Requests 2.0.8 release and reverted in Requests 2.0.9 due to it causing problems with Curl 7.29.0 (and possibly others). See #838

Re-opening this issue as it is now unsolved again. This will need further investigation in conjunction with #838.

@jrfnl jrfnl reopened this Nov 8, 2023
@jrfnl jrfnl removed this from the 2.0.8 milestone Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants