title: What is the importance of setting CURLOPT_HTTP_VERSION in an application?
body: <p>In someone else's code I came across this option setting for cURL:</p>
  
  <pre><code>curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  </code></pre>
  
  <p>The PHP documentation says that by default this option is set to CURL_HTTP_VERSION_NONE which lets cURL decide which HTTP version to use.  Otherwise, you can force HTTP 1.0 or HTTP 1.1.  Someday there will be the option to force HTTP 2.0 (see this thread on the cURL mailing list: <a href="http://curl.haxx.se/mail/lib-2013-09/0020.html" rel="noreferrer">http://curl.haxx.se/mail/lib-2013-09/0020.html</a>)</p>
  
  <p>I am still trying to understand the differences between HTTP 1.0 vs 1.1 from the question <a href="https://stackoverflow.com/questions/246859/http-1-0-vs-1-1">HTTP 1.0 vs 1.1</a> and now I'm wondering what kind of considerations are needed for the future with HTTP 2.0.</p>
  
  <p>My questions are:</p>
  
  <ul>
  <li><p>Is setting the CURLOPT_HTTP_VERSION in an app a good idea if I can't always be sure what HTTP version the server is capable of? Or should I detect the version using $_SERVER['SERVER_PROTOCOL'] and change the CURLOPT_HTTP_VERSION based on that? </p></li>
  <li><p>If I do know the server is capable of HTTP 1.1 (or someday HTTP 2.0) is there any reason to think cURL won't be able to figure this out?</p></li>
  <li><p>Is there a case in which it's better to use HTTP 1.0 rather than HTTP 1.1? </p></li>
  </ul>