webrtc: include query parameters in session URL (#3920)

This commit is contained in:
Alessandro Ros
2024-10-28 18:35:55 +01:00
committed by GitHub
parent 1dfb5ba4b9
commit 51b21c8adb
3 changed files with 11 additions and 4 deletions
+9 -2
View File
@@ -48,14 +48,21 @@ func writeError(ctx *gin.Context, statusCode int, err error) {
})
}
func sessionLocation(publish bool, path string, secret uuid.UUID) string {
func sessionLocation(publish bool, path string, rawQuery string, secret uuid.UUID) string {
ret := "/" + path + "/"
if publish {
ret += "whip"
} else {
ret += "whep"
}
ret += "/" + secret.String()
if rawQuery != "" {
ret += "?" + rawQuery
}
return ret
}
@@ -216,7 +223,7 @@ func (s *httpServer) onWHIPPost(ctx *gin.Context, pathName string, publish bool)
ctx.Header("ID", res.sx.uuid.String())
ctx.Header("Accept-Patch", "application/trickle-ice-sdpfrag")
ctx.Writer.Header()["Link"] = whip.LinkHeaderMarshal(servers)
ctx.Header("Location", sessionLocation(publish, pathName, res.sx.secret))
ctx.Header("Location", sessionLocation(publish, pathName, ctx.Request.URL.RawQuery, res.sx.secret))
ctx.Writer.WriteHeader(http.StatusCreated)
ctx.Writer.Write(res.answer)
}
+1 -1
View File
@@ -399,7 +399,7 @@ const editAnswer = (sdp) => {
};
const sendLocalCandidates = (candidates) => {
fetch(sessionUrl + window.location.search, {
fetch(sessionUrl, {
method: 'PATCH',
headers: {
'Content-Type': 'application/trickle-ice-sdpfrag',
+1 -1
View File
@@ -376,7 +376,7 @@ const onError = (err) => {
};
const sendLocalCandidates = (candidates) => {
fetch(sessionUrl + window.location.search, {
fetch(sessionUrl, {
method: 'PATCH',
headers: {
'Content-Type': 'application/trickle-ice-sdpfrag',