Fix authorization

main
Charlotte Som 2023-02-23 16:46:22 +00:00
parent ad5f6b8db5
commit 57a75ef495
1 changed files with 2 additions and 1 deletions

View File

@ -135,8 +135,9 @@ func HandleWHIP(res http.ResponseWriter, req *http.Request) {
} }
streamName, streamPassword, _ := strings.Cut(authorization, ":") streamName, streamPassword, _ := strings.Cut(authorization, ":")
if db.QueryRow("SELECT * FROM streams WHERE stream = ? AND password = ?", streamName, streamPassword).Err() != nil { if err := db.QueryRow("SELECT * FROM streams WHERE stream = ? AND password = ?", streamName, streamPassword).Scan(); err != nil {
logHTTPError(res, "Invalid stream authorization", http.StatusUnauthorized) logHTTPError(res, "Invalid stream authorization", http.StatusUnauthorized)
return
} }
offer, err := io.ReadAll(req.Body) offer, err := io.ReadAll(req.Body)