mirror of https://github.com/Xhofe/alist
🎨 format code
parent
ac8f5d5737
commit
1542878d66
|
@ -55,6 +55,20 @@ func Proxy(ctx *fiber.Ctx) error {
|
|||
return ctx.SendFile(link)
|
||||
} else {
|
||||
driver.Proxy(ctx)
|
||||
//ctx.Response().ImmediateHeaderFlush = true
|
||||
//var ProxyNetHttp = fasthttpadaptor.NewFastHTTPHandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// target, _ := url.Parse(link)
|
||||
// protocol := "https://"
|
||||
// if strings.HasPrefix(link, "http://") {
|
||||
// protocol = "http://"
|
||||
// }
|
||||
// targetHost, _ := url.Parse(fmt.Sprintf("%s%s", protocol, target.Host))
|
||||
// proxy := httputil.NewSingleHostReverseProxy(targetHost)
|
||||
// r.URL = target
|
||||
// r.Host = target.Host
|
||||
// proxy.ServeHTTP(w, r)
|
||||
//})
|
||||
//ProxyNetHttp(ctx.Context())
|
||||
if err := proxy.Do(ctx, link); err != nil {
|
||||
log.Errorf("proxy error: %s", err)
|
||||
return ErrorResp(ctx,err,500)
|
||||
|
|
Loading…
Reference in New Issue