HTTPRequest HTTP请求
| 35 | |
| 36 | // HTTPRequest HTTP请求 |
| 37 | type HTTPRequest struct { |
| 38 | requestId string |
| 39 | |
| 40 | // 外部参数 |
| 41 | RawReq *http.Request |
| 42 | RawWriter http.ResponseWriter |
| 43 | ReqServer *serverconfigs.ServerConfig |
| 44 | ReqHost string // 请求的Host |
| 45 | ServerName string // 实际匹配到的Host |
| 46 | ServerAddr string // 实际启动的服务器监听地址 |
| 47 | IsHTTP bool |
| 48 | IsHTTPS bool |
| 49 | IsHTTP3 bool |
| 50 | isHealthCheck bool |
| 51 | |
| 52 | // 共享参数 |
| 53 | // DO NOT change the variable after created |
| 54 | nodeConfig *nodeconfigs.NodeConfig |
| 55 | |
| 56 | // ln request |
| 57 | isLnRequest bool |
| 58 | lnRemoteAddr string |
| 59 | |
| 60 | // 内部参数 |
| 61 | isSubRequest bool |
| 62 | writer *HTTPWriter |
| 63 | web *serverconfigs.HTTPWebConfig // Web配置,重要提示:由于引用了别的共享的配置,所以操作中只能读取不要修改 |
| 64 | reverseProxyRef *serverconfigs.ReverseProxyRef // 反向代理引用 |
| 65 | reverseProxy *serverconfigs.ReverseProxyConfig // 反向代理配置,重要提示:由于引用了别的共享的配置,所以操作中只能读取不要修改 |
| 66 | rawURI string // 原始的URI |
| 67 | uri string // 经过rewrite等运算之后的URI |
| 68 | varMapping map[string]string // 变量集合 |
| 69 | requestFromTime time.Time // 请求开始时间 |
| 70 | requestCost float64 // 请求耗时 |
| 71 | filePath string // 请求的文件名,仅在读取Root目录下的内容时不为空 |
| 72 | origin *serverconfigs.OriginConfig // 源站 |
| 73 | originAddr string // 源站实际地址 |
| 74 | originStatus int32 // 源站响应代码 |
| 75 | errors []string // 错误信息 |
| 76 | rewriteRule *serverconfigs.HTTPRewriteRule // 匹配到的重写规则 |
| 77 | rewriteReplace string // 重写规则的目标 |
| 78 | rewriteIsExternalURL bool // 重写目标是否为外部URL |
| 79 | remoteAddr string // 计算后的RemoteAddr |
| 80 | |
| 81 | cacheRef *serverconfigs.HTTPCacheRef // 缓存设置 |
| 82 | cacheKey string // 缓存使用的Key |
| 83 | isCached bool // 是否已经被缓存 |
| 84 | cacheCanTryStale bool // 是否可以尝试使用Stale缓存 |
| 85 | |
| 86 | isAttack bool // 是否是攻击请求 |
| 87 | requestBodyData []byte // 读取的Body内容 |
| 88 | |
| 89 | isWebsocketResponse bool // 是否为Websocket响应(非请求) |
| 90 | |
| 91 | // WAF相关 |
| 92 | firewallPolicyId int64 |
| 93 | firewallRuleGroupId int64 |
| 94 | firewallRuleSetId int64 |
nothing calls this directly
no outgoing calls
no test coverage detected