MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / requestServerPort

Method requestServerPort

internal/nodes/http_request.go:1468–1488  ·  view source on GitHub ↗

请求的服务器地址中的端口

()

Source from the content-addressed store, hash-verified

1466
1467// 请求的服务器地址中的端口
1468func (this *HTTPRequest) requestServerPort() int {
1469 if len(this.ServerAddr) > 0 {
1470 _, port, err := net.SplitHostPort(this.ServerAddr)
1471 if err == nil && len(port) > 0 {
1472 return types.Int(port)
1473 }
1474 }
1475
1476 var host = this.RawReq.Host
1477 if len(host) > 0 {
1478 _, port, err := net.SplitHostPort(host)
1479 if err == nil && len(port) > 0 {
1480 return types.Int(port)
1481 }
1482 }
1483
1484 if this.IsHTTP {
1485 return 80
1486 }
1487 return 443
1488}
1489
1490func (this *HTTPRequest) Id() string {
1491 return this.requestId

Callers 4

FormatMethod · 0.95
doWebsocketMethod · 0.95
logMethod · 0.95
doOriginRequestMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected