ithewei %!s(int64=3) %!d(string=hai) anos
pai
achega
7af5229657
Modificáronse 3 ficheiros con 13 adicións e 5 borrados
  1. 2 2
      README-CN.md
  2. 1 1
      README.md
  3. 10 2
      http/client/http_client.cpp

+ 2 - 2
README-CN.md

@@ -45,9 +45,9 @@
 - [libhv教程18--动手写一个tinyhttpd](https://hewei.blog.csdn.net/article/details/121706604)
 - [libhv教程19--MQTT的实现与使用](https://hewei.blog.csdn.net/article/details/122753665)
 
-## ✨ 特
+## ✨ 特
 
-- 跨平台(Linux, Windows, MacOS, Solaris, Android, iOS)
+- 跨平台(Linux, Windows, MacOS, BSD, Solaris, Android, iOS)
 - 高性能事件循环(网络IO事件、定时器事件、空闲事件、自定义事件)
 - TCP/UDP服务端/客户端/代理
 - TCP支持心跳、转发、拆包、多线程安全write和close等特性

+ 1 - 1
README.md

@@ -23,7 +23,7 @@ but simpler api and richer protocols.
 
 ## ✨ Features
 
-- Cross-platform (Linux, Windows, MacOS, Solaris, Android, iOS)
+- Cross-platform (Linux, Windows, MacOS, BSD, Solaris, Android, iOS)
 - High-performance EventLoop (IO, timer, idle, custom)
 - TCP/UDP client/server/proxy
 - TCP supports heartbeat, upstream, unpack, MultiThread-safe write and close, etc.

+ 10 - 2
http/client/http_client.cpp

@@ -313,9 +313,17 @@ int __http_client_send(http_client_t* cli, HttpRequest* req, HttpResponse* resp)
     }
     CURL* curl = cli->curl;
 
+    // proxy
+    if (req->IsProxy()) {
+        curl_easy_setopt(curl, CURLOPT_PROXY, req->host.c_str());
+        curl_easy_setopt(curl, CURLOPT_PROXYPORT, req->port);
+    }
+
     // SSL
-    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
-    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
+    if (req->IsHttps()) {
+        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
+        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
+    }
 
     // http2
     if (req->http_major == 2) {