zdebel gist felülvizsgálása 1 year ago. Revízióhoz ugrás
Nincsenek változtatások
zdebel gist felülvizsgálása 1 year ago. Revízióhoz ugrás
1 file changed, 0 insertions, 0 deletions
fix.go fájl átnevezve erre: opengist auth fix.go
Fájl átnevezve változtatások nélkül
zdebel gist felülvizsgálása 1 year ago. Revízióhoz ugrás
1 file changed, 21 insertions
fix.go(fájl létrehozva)
| @@ -0,0 +1,21 @@ | |||
| 1 | + | func oauth(ctx echo.Context) error { | |
| 2 | + | provider := ctx.Param("provider") | |
| 3 | + | ||
| 4 | + | httpProtocol := "http" | |
| 5 | + | if ctx.Request().TLS != nil || ctx.Request().Header.Get("X-Forwarded-Proto") == "https" { | |
| 6 | + | httpProtocol = "https" | |
| 7 | + | } | |
| 8 | + | forwarded_hdr := ctx.Request().Header.Get("Forwarded") | |
| 9 | + | if forwarded_hdr != "" { | |
| 10 | + | fields := strings.Split(forwarded_hdr, ";") | |
| 11 | + | fwd := make(map[string]string) | |
| 12 | + | for _, v := range fields { | |
| 13 | + | p := strings.Split(v, "=") | |
| 14 | + | fwd[p[0]] = p[1] | |
| 15 | + | } | |
| 16 | + | val, ok := fwd["proto"] | |
| 17 | + | if ok && val == "https" { | |
| 18 | + | httpProtocol = "https" | |
| 19 | + | } | |
| 20 | + | } | |
| 21 | + | ... | |