I have been getting this error when trying to install plugins:

Installation failed: Download failed. cURL error 18: transfer closed with 2126 bytes remaining to read.

I have found a solution on how to fix the error by suppressing the 'Expect: 100-continue' header using the following code:

curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));

However, since Wordpress was installed with Windows Platform Installer and is running on IIS 10, I haven't been able to find an appropriate place to modify the cURL option. If anyone knows what part of the PHP code calls $curl, it would really help me solve this issue. Your input and positive support is highly appreciated.

  • hmmm this is an XY problem, where setting the curl option is Problem Y, and the error message is problem X. As this is an IIS server, which is rare for WP, can you replicate the issue under an Apache or Nginx based server stack such as XAMP/WAMP/VVV/or one of the docker based systems? This error isn't normal, and unexpected, and implies network issues at your end. As an aside, the workaround you linked to is a hack, and will just give you another problem if the end of the downloaded archive is missing bits at the end
    – Tom J Nowell
    Commented Oct 25, 2017 at 17:18
  • @TomJNowell Thanks Tom. I completely agree. I have been talking with my hosting provider and they are searching for a solution. I'm considering moving my server (need Windows for other purposes). But, if I got a fix for now that would be great. If you have any more insight into the networking issue, would love to get your input. Commented Oct 25, 2017 at 17:20

1 Answer 1


Not sure about your specific cURL script but the base cURL function can be found here inside of WordPress:


Also remember modifying WordPress core can cause issues so it's always best to try to leverage hooks and filters. You may be able to modify the default cURL request via http_api_curl.


This article also breaks down PHP, cURL and WordPress with more detail: https://deliciousbrains.com/php-curl-how-wordpress-makes-http-requests/

Hope this helps!

  • Hey Tom, so if I were to write it as a function call, I could add this into my functions.php file? Commented Oct 25, 2017 at 17:22
  • I haven't used this hook first hand, so please take this with a grain of salt, but I do believe you can yes. Should be something like add_action('http_api_curl', 'custom_ http_api_curl'); function custom_http_api_curl(){...}
    – Tom
    Commented Oct 25, 2017 at 17:26
  • @DomainsFeatured yes, you can put the filter and function inside a 1 file plugin or your themes functions.php
    – Tom J Nowell
    Commented Oct 25, 2017 at 17:31
  • @DomainsFeatured I would listen to TomJNowell, he's the higher ranking of the "tom's" :)
    – Tom
    Commented Oct 25, 2017 at 17:33
  • @TomJNowell and Tom, if either of you guys want to put the function as an answer, I think that would be a perfect solution. I would certainly upvote and choose it as the answer after a day or so. I think other future users would find that helpful as well. Commented Oct 25, 2017 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.