Check ICE ufrag and pwd in WHIP PATCH requests.
This commit is contained in:
+15
-1
@@ -346,7 +346,7 @@ func whipResourceHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
_, _, candidates, err := parseSDPFrag(
|
||||
ufrag, pwd, candidates, err := parseSDPFrag(
|
||||
http.MaxBytesReader(w, r.Body, sdpLimit),
|
||||
)
|
||||
if err != nil {
|
||||
@@ -354,6 +354,20 @@ func whipResourceHandler(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "bad request", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
u, p, err := c.UFragPwd()
|
||||
if err != nil {
|
||||
log.Printf("WHIP UfragPwd: %v", err)
|
||||
http.Error(w, "internal server error",
|
||||
http.StatusInternalServerError,
|
||||
)
|
||||
return
|
||||
}
|
||||
if u != ufrag || p != pwd {
|
||||
http.Error(w, "ICE restarts are not supported yet",
|
||||
http.StatusUnprocessableEntity,
|
||||
)
|
||||
return
|
||||
}
|
||||
for _, init := range candidates {
|
||||
err := c.GotICECandidate(init)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user