Skip to content

Commit

Permalink
优化HttpHelper,移除BindIPEndPointCallback;
Browse files Browse the repository at this point in the history
  • Loading branch information
zqlovejyc committed Jan 25, 2021
1 parent c05285a commit 7d3608b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions ZqUtils.Core/Helpers/HttpHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,6 @@ private void SetCerList(HttpRequest req)
}
}

/// <summary>
/// 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。
/// </summary>
/// <param name="servicePoint">ServicePoint</param>
/// <param name="remoteEndPoint">IPEndPoint</param>
/// <param name="retryCount">int</param>
/// <returns>IPEndPoint</returns>
private IPEndPoint BindIPEndPointCallback(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount) => ipEndPoint;

/// <summary>
/// 设置代理
/// </summary>
Expand Down Expand Up @@ -341,8 +332,9 @@ private void SetRequest(HttpRequest req)
if (req.IPEndPoint != null)
{
ipEndPoint = req.IPEndPoint;

//设置本地的出口ip和端口
request.ServicePoint.BindIPEndPointDelegate = new BindIPEndPoint(BindIPEndPointCallback);
request.ServicePoint.BindIPEndPointDelegate = (servicePoint, remoteEndPoint, retryCount) => ipEndPoint;
}

//设置Header参数
Expand Down

0 comments on commit 7d3608b

Please sign in to comment.