瀏覽代碼

fix https proxy

ithewei 3 年之前
父節點
當前提交
920c28be97
共有 2 個文件被更改,包括 2 次插入1 次删除
  1. 1 0
      http/HttpMessage.h
  2. 1 1
      http/client/http_client.cpp

+ 1 - 0
http/HttpMessage.h

@@ -489,6 +489,7 @@ public:
     void FillHost(const char* host, int port = DEFAULT_HTTP_PORT);
     void SetHost(const char* host, int port = DEFAULT_HTTP_PORT);
     void SetProxy(const char* host, int port);
+    bool IsProxy() { return proxy; }
 
     // Range: bytes=0-4095
     void SetRange(long from = 0, long to = -1) {

+ 1 - 1
http/client/http_client.cpp

@@ -481,7 +481,7 @@ int __http_client_send(http_client_t* cli, HttpRequest* req, HttpResponse* resp)
     int err = 0;
     int timeout = req->timeout;
     int connfd = cli->fd;
-    bool https = req->IsHttps();
+    bool https = req->IsHttps() && !req->IsProxy();
     bool keepalive = true;
 
     time_t start_time = time(NULL);