[wp-trac] [WordPress Trac] #54588: cURL incompatibility with Kaspersky (kesl)

WordPress Trac noreply at wordpress.org
Mon Dec 6 12:46:21 UTC 2021

#54588: cURL incompatibility with Kaspersky (kesl)
 Reporter:  mirkolofio    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
 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
 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:

 // 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

Ticket URL: <https://core.trac.wordpress.org/ticket/54588>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list