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

Method Do

internal/nodes/http_request.go:150–318  ·  view source on GitHub ↗

Do 执行请求

()

Source from the content-addressed store, hash-verified

148
149// Do 执行请求
150func (this *HTTPRequest) Do() {
151 // 初始化
152 this.init()
153
154 // 当前服务的反向代理配置
155 if this.ReqServer.ReverseProxyRef != nil && this.ReqServer.ReverseProxy != nil {
156 this.reverseProxyRef = this.ReqServer.ReverseProxyRef
157 this.reverseProxy = this.ReqServer.ReverseProxy
158 }
159
160 // Web配置
161 err := this.configureWeb(this.ReqServer.Web, true, 0)
162 if err != nil {
163 this.write50x(err, http.StatusInternalServerError, "Failed to configure the server", "配置服务失败", false)
164 this.doEnd()
165 return
166 }
167
168 // 是否为低级别节点
169 this.isLnRequest = this.checkLnRequest()
170
171 // 回调事件
172 this.onInit()
173 if this.writer.isFinished {
174 this.doEnd()
175 return
176 }
177
178 // 处理健康检查
179 var healthCheckKey = this.RawReq.Header.Get(serverconfigs.HealthCheckHeaderName)
180 if len(healthCheckKey) > 0 {
181 if this.doHealthCheck(healthCheckKey, &this.isHealthCheck) {
182 this.doEnd()
183 return
184 }
185 }
186
187 if !this.isLnRequest {
188 // 特殊URL处理
189 if len(this.rawURI) > 1 && this.rawURI[1] == '.' {
190 // ACME
191 // TODO 需要配置是否启用ACME检测
192 if strings.HasPrefix(this.rawURI, "/.well-known/acme-challenge/") {
193 if this.doACME() {
194 this.doEnd()
195 return
196 }
197 }
198 }
199
200 // 套餐
201 if this.ReqServer.UserPlan != nil {
202 if this.doPlanBefore() {
203 this.doEnd()
204 return
205 }
206 }
207

Callers 15

doSubRequestMethod · 0.95
StopMethod · 0.80
setupMethod · 0.80
DefaultStoreFunction · 0.80
CloseMethod · 0.80
BenchmarkKVTask_AddFunction · 0.80
runActionMethod · 0.80
CloseMethod · 0.80
DiscardMethod · 0.80
CloseMethod · 0.80
DiscardMethod · 0.80
CloseMethod · 0.80

Calls 15

initMethod · 0.95
configureWebMethod · 0.95
write50xMethod · 0.95
doEndMethod · 0.95
checkLnRequestMethod · 0.95
onInitMethod · 0.95
doHealthCheckMethod · 0.95
doACMEMethod · 0.95
doPlanBeforeMethod · 0.95
doTrafficLimitMethod · 0.95
isUAMRequestMethod · 0.95
doUAMMethod · 0.95

Tested by 3

BenchmarkKVTask_AddFunction · 0.64
TestMatchRemoteCacheFunction · 0.64