mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
24w18d
This commit is contained in:
parent
47d062a1c4
commit
c50f23c399
14 changed files with 78 additions and 70 deletions
|
|
@ -117,7 +117,6 @@ func NoRouteHandler(cfg *config.Config) gin.HandlerFunc {
|
|||
|
||||
func ProxyRequest(c *gin.Context, u string, cfg *config.Config, mode string) {
|
||||
method := c.Request.Method
|
||||
// 记录 IP Method URL UA
|
||||
logInfo("%s %s %s %s", c.ClientIP(), method, u, c.Request.Header.Get("User-Agent"))
|
||||
|
||||
client := createHTTPClient(mode)
|
||||
|
|
@ -150,7 +149,6 @@ func ProxyRequest(c *gin.Context, u string, cfg *config.Config, mode string) {
|
|||
}
|
||||
}
|
||||
|
||||
// createHTTPClient 创建并配置 HTTP 客户端
|
||||
func createHTTPClient(mode string) *req.Client {
|
||||
client := req.C()
|
||||
switch mode {
|
||||
|
|
@ -220,10 +218,11 @@ func HandleResponseSize(resp *req.Response, cfg *config.Config, c *gin.Context)
|
|||
}
|
||||
|
||||
func CopyResponseHeaders(resp *req.Response, c *gin.Context, cfg *config.Config) {
|
||||
removeHeaders(resp)
|
||||
|
||||
copyHeaders(resp, c)
|
||||
|
||||
removeHeaders(resp)
|
||||
|
||||
setCORSHeaders(c, cfg)
|
||||
|
||||
setDefaultHeaders(c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue