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

Method doFastcgi

internal/nodes/http_request_fastcgi.go:24–230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22)
23
24func (this *HTTPRequest) doFastcgi() (shouldStop bool) {
25 fastcgiList := []*serverconfigs.HTTPFastcgiConfig{}
26 for _, fastcgi := range this.web.FastcgiList {
27 if !fastcgi.IsOn {
28 continue
29 }
30 fastcgiList = append(fastcgiList, fastcgi)
31 }
32 if len(fastcgiList) == 0 {
33 return false
34 }
35 shouldStop = true
36 fastcgi := fastcgiList[rands.Int(0, len(fastcgiList)-1)]
37
38 env := fastcgi.FilterParams()
39 if !env.Has("DOCUMENT_ROOT") {
40 env["DOCUMENT_ROOT"] = ""
41 }
42
43 if !env.Has("REMOTE_ADDR") {
44 env["REMOTE_ADDR"] = this.requestRemoteAddr(true)
45 }
46 if !env.Has("QUERY_STRING") {
47 u, err := url.ParseRequestURI(this.uri)
48 if err == nil {
49 env["QUERY_STRING"] = u.RawQuery
50 } else {
51 env["QUERY_STRING"] = this.RawReq.URL.RawQuery
52 }
53 }
54 if !env.Has("SERVER_NAME") {
55 env["SERVER_NAME"] = this.ReqHost
56 }
57 if !env.Has("REQUEST_URI") {
58 env["REQUEST_URI"] = this.uri
59 }
60 if !env.Has("HOST") {
61 env["HOST"] = this.ReqHost
62 }
63
64 if len(this.ServerAddr) > 0 {
65 if !env.Has("SERVER_ADDR") {
66 env["SERVER_ADDR"] = this.ServerAddr
67 }
68 if !env.Has("SERVER_PORT") {
69 _, port, err := net.SplitHostPort(this.ServerAddr)
70 if err == nil {
71 env["SERVER_PORT"] = port
72 }
73 }
74 }
75
76 // 设置为持久化连接
77 var requestConn = this.RawReq.Context().Value(HTTPConnContextKey)
78 if requestConn == nil {
79 return
80 }
81 requestClientConn, ok := requestConn.(ClientConnInterface)

Callers 1

doBeginMethod · 0.95

Calls 15

requestRemoteAddrMethod · 0.95
write50xMethod · 0.95
addVarMappingMethod · 0.95
FormatMethod · 0.95
processRequestHeadersMethod · 0.95
requestLengthMethod · 0.95
bytePoolMethod · 0.95
addErrorMethod · 0.95
WarnFunction · 0.92
ContextMethod · 0.80
ClientMethod · 0.80

Tested by

no test coverage detected