修复获取目标地址IP失败导致程序崩溃的问题

This commit is contained in:
Liujian
2023-11-07 17:50:15 +08:00
parent b47a447b83
commit 00643c3046
7 changed files with 45 additions and 24 deletions

View File

@@ -151,15 +151,14 @@ func (ctx *HttpContext) SendTo(scheme string, node eoscContext.INode, timeout ti
agent.setStatusCode(504)
} else {
ctx.response.ResponseHeader.refresh()
agent.setRemoteIP(tcpAddr.IP.String())
agent.setRemotePort(tcpAddr.Port)
agent.setStatusCode(ctx.fastHttpRequestCtx.Response.StatusCode())
}
agent.responseBody = string(ctx.response.Response.Body())
agent.setRemoteIP(tcpAddr.IP.String())
agent.setRemotePort(tcpAddr.Port)
agent.setResponseLength(ctx.fastHttpRequestCtx.Response.Header.ContentLength())
ctx.response.remoteIP = tcpAddr.IP.String()
ctx.response.remotePort = tcpAddr.Port
ctx.proxyRequests = append(ctx.proxyRequests, agent)
return ctx.response.responseError