feat(httppaths): remove connection checker
All checks were successful
CI / build (push) Successful in 59s
All checks were successful
CI / build (push) Successful in 59s
I doubt this is even used
This commit is contained in:
parent
319991c7b8
commit
cc4671c677
1 changed files with 0 additions and 24 deletions
24
httppaths.go
24
httppaths.go
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
|
@ -24,17 +23,6 @@ func forbiddenChecker(resp *http.Response, w http.ResponseWriter) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func connectionChecker(ctx context.Context) bool {
|
||||
// To check if the connection has been closed. To prevent
|
||||
// doing a useless request to google servers
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func videoplayback(w http.ResponseWriter, req *http.Request) {
|
||||
q := req.URL.Query()
|
||||
|
||||
|
@ -155,10 +143,6 @@ func videoplayback(w http.ResponseWriter, req *http.Request) {
|
|||
postRequest.Header.Add("Referer", "https://www.youtube.com/")
|
||||
headRequest.Header.Add("Referer", "https://www.youtube.com/")
|
||||
|
||||
if connectionChecker(req.Context()) {
|
||||
return
|
||||
}
|
||||
|
||||
resp := &http.Response{}
|
||||
|
||||
for i := 0; i < 5; i++ {
|
||||
|
@ -256,10 +240,6 @@ func vi(w http.ResponseWriter, req *http.Request) {
|
|||
|
||||
request.Header.Set("User-Agent", default_ua)
|
||||
|
||||
if connectionChecker(req.Context()) {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.Do(request)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
|
@ -299,10 +279,6 @@ func ggpht(w http.ResponseWriter, req *http.Request) {
|
|||
log.Panic(err)
|
||||
}
|
||||
|
||||
if connectionChecker(req.Context()) {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.Do(request)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
|
|
Loading…
Add table
Reference in a new issue