skip to Main Content

I host a file on a server that is fetched by CocoaPods as part of a pod. CocoaPods uses curl internally to fetch this. Curl 7.54.0 in the latest macOS 10.14.2 (18C54) has a bug which causes issues with files fetched over HTTP/2. This means that developers using my pod keep getting install failures due to the curl bug.

As curl is used inside Cocoapods I can’t provide command line switches to curl (at least I don’t think Cocoapods provides a way to do so).

Is there any way using Apache configuration, htaccess or PHP I can enforce HTTP/1.1?

2

Answers


  1. cURL has a command-line switch -http1.1. in PHP that might be:

    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    

    … that’s at least what the documentation says.


    mod_rewrite can also be used to forbid HTTP/2.0 (but no clue how to switch it):

    RewriteCond %{SERVER_PROTOCOL} ^HTTP/2.0$ [NC]
    RewriteRule . [F,L]
    

    I think that virtual host configuration is the most solid (this won’t work in a .htaccess file):

    PolicyVersion enforce HTTP/1.1 
    
    Login or Signup to reply.
  2. You can decide which version to use by setting the option CURLOPT_HTTP_VERSION

    // default, lets CURL decide which version to use    
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NON);
    
    // forces HTTP/1.0
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
    
    // forces HTTP/1.1    
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search