mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-16 04:55:58 +08:00
增加http代理功能 (#2988)
支持通过http代理拉流, 避免内外网复杂网络环境时需要专门配置防火墙,现在只需要配置一台代理内网的服务器. --------- Co-authored-by: xia-chu <771730766@qq.com>
This commit is contained in:
@@ -141,6 +141,11 @@ public:
|
||||
*/
|
||||
void setCompleteTimeout(size_t timeout_ms);
|
||||
|
||||
/**
|
||||
* 设置http代理url
|
||||
*/
|
||||
void setProxyUrl(std::string proxy_url);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* 收到http回复头
|
||||
@@ -181,11 +186,16 @@ protected:
|
||||
void onFlush() override;
|
||||
void onManager() override;
|
||||
|
||||
void clearResponse();
|
||||
|
||||
bool checkProxyConnected(const char *data, size_t len);
|
||||
bool isUsedProxy() const;
|
||||
bool isProxyConnected() const;
|
||||
|
||||
private:
|
||||
void onResponseCompleted_l(const toolkit::SockException &ex);
|
||||
void onConnect_l(const toolkit::SockException &ex);
|
||||
void checkCookie(HttpHeader &headers);
|
||||
void clearResponse();
|
||||
|
||||
private:
|
||||
//for http response
|
||||
@@ -215,6 +225,13 @@ private:
|
||||
toolkit::Ticker _wait_header;
|
||||
toolkit::Ticker _wait_body;
|
||||
toolkit::Ticker _wait_complete;
|
||||
|
||||
bool _used_proxy = false;
|
||||
bool _proxy_connected = false;
|
||||
uint16_t _proxy_port;
|
||||
std::string _proxy_url;
|
||||
std::string _proxy_host;
|
||||
std::string _proxy_auth;
|
||||
};
|
||||
|
||||
} /* namespace mediakit */
|
||||
|
||||
Reference in New Issue
Block a user