title: C Program curl: (35) error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
body: <p>I'm trying to make a C program that downloads an image given a url.
  However, I can't seem to be able to download from a particular website using libcurl-7.52.1.
  When using the curl command on this url gives me:</p>
  
  <pre><code>~ $ curl -v https://files.yande.re/jpeg/ae340a06572fa8f48d63fd418197e1cd/yande.re%20292874%20makise_kurisu%20ninnzinn%20pantyhose%20steins%3Bgate.jpg
  *   Trying 5.39.10.56...
  * TCP_NODELAY set
  * Connected to files.yande.re (5.39.10.56) port 443 (#0)
  * ALPN, offering h2
  * ALPN, offering http/1.1
  * successfully set certificate verify locations:
  *   CAfile: /etc/ssl/certs/ca-certificates.crt
    CApath: /etc/ssl/certs
  * TLSv1.2 (OUT), TLS header, Certificate Status (22):
  * TLSv1.2 (OUT), TLS handshake, Client hello (1):
  * TLSv1.2 (IN), TLS header, Unknown (21):
  * TLSv1.2 (IN), TLS alert, Server hello (2):
  * error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
  * Curl_http_done: called premature == 1
  * stopped the pause stream!
  * Closing connection 0
  curl: (35) error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
  </code></pre>
  
  <p>When using my own program with the following code and curl options, I get the same error:</p>
  
  <pre><code>FILE *img_fp;
  img_fp = fopen(file_name, "wb");
  
  /* Initialize curl */
  CURL *curl_handle = curl_easy_init();
  CURLcode res;
  
  if (curl_handle) {
      /* set the working website to this domain */
      /* weburl is the url of the website */
      curl_easy_setopt(curl_handle, CURLOPT_URL, web_url);
  
      /* ask libcurl to show us the verbose output */
      curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L);
  
      /* Set the user agent to chrome */
      curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "chrome/55.0.2883.75");
  
      /* Set the data to pass when the function is called */
      curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, img_fp);
  
      res = curl_easy_perform(curl_handle);
  
      /* Check for errors */
      if (res != CURLE_OK) {
          printf("curl_easy_perform() failed: %s\n",
                  curl_easy_strerror(res));
  
      }
  }
  Output:
  *   Trying 5.39.10.56...
  * TCP_NODELAY set
  * Connected to files.yande.re (5.39.10.56) port 443 (#0)
  * ALPN, offering http/1.1
  * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
  * successfully set certificate verify locations:
  *   CAfile: /etc/ssl/certs/ca-certificates.crt
    CApath: /etc/ssl/certs
  * error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
  * Curl_http_done: called premature == 1
  * stopped the pause stream!
  * Closing connection 0
  curl_easy_perform() failed: SSL connect error
  </code></pre>
  
  <p>How can I fix this and download the file?</p>