mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
修正在指定配置文件forwarded_ip_header的值后,无法获取不通过代理播放的客户端IP。
This commit is contained in:
parent
4f47b7a5fe
commit
f765e5365b
@ -674,7 +674,10 @@ bool HttpSession::emitHttpEvent(bool doInvoke){
|
|||||||
|
|
||||||
std::string HttpSession::get_peer_ip() {
|
std::string HttpSession::get_peer_ip() {
|
||||||
GET_CONFIG(string, forwarded_ip_header, Http::kForwardedIpHeader);
|
GET_CONFIG(string, forwarded_ip_header, Http::kForwardedIpHeader);
|
||||||
return forwarded_ip_header.empty() ? TcpSession::get_peer_ip() : _parser.getHeader()[forwarded_ip_header];
|
if(!forwarded_ip_header.empty() && !_parser.getHeader()[forwarded_ip_header].empty()){
|
||||||
|
return _parser.getHeader()[forwarded_ip_header];
|
||||||
|
}
|
||||||
|
return TcpSession::get_peer_ip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpSession::Handle_Req_POST(ssize_t &content_len) {
|
void HttpSession::Handle_Req_POST(ssize_t &content_len) {
|
||||||
|
Loading…
Reference in New Issue
Block a user