search

Home  >  Q&A  >  body text

c++ - 关于libcurl ssl的问题

问题:目前本地libcurl已经支持https的发送,但是有个问题,想在接口处去验证服务器是否支持https请求,这样外围模块只需要直接丢url到libcurl就行。请问libcurl有这么一个接口,可以判断服务端是否支持https请求。

说白了:就是客户端有没有一种方法,可以查询服务器是否支持https请求?

阿神阿神2804 days ago599

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 14:52:07

    No special interface. You set up curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf); and connect directly. If SSL is not supported. The error CURLE_SSL_CONNECT_ERROR will be returned, and the error cause will be in the error buffer.
    The main thing is this, whether to use SSL is determined by the protocol of the URL, whether there is https or not. Because SSL can be set on different ports, this is also URL specified. So it all depends on how the URL is written. Curl just connects based on the URL.

    reply
    0
  • 迷茫

    迷茫2017-04-17 14:52:07

    Check the API of libcurl and it should be there.

    reply
    0
  • Cancelreply