Prevent processing of already expired videoplayback links
All checks were successful
CI / build (push) Successful in 5m4s
All checks were successful
CI / build (push) Successful in 5m4s
This commit is contained in:
parent
3b89ea41e7
commit
56345e5bae
1 changed files with 14 additions and 0 deletions
14
httppaths.go
14
httppaths.go
|
@ -6,12 +6,26 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
func videoplayback(w http.ResponseWriter, req *http.Request) {
|
||||
q := req.URL.Query()
|
||||
expire, err := strconv.ParseInt(q.Get("expire"), 10, 64)
|
||||
if err != nil {
|
||||
w.WriteHeader(500)
|
||||
}
|
||||
|
||||
// Prevent the process of already expired playbacks
|
||||
// since they will return 403 from googlevideo servers.
|
||||
if (expire - time.Now().Unix()) <= 0 {
|
||||
w.WriteHeader(403)
|
||||
return
|
||||
}
|
||||
|
||||
host := q.Get("host")
|
||||
q.Del("host")
|
||||
|
||||
|
|
Loading…
Reference in a new issue