Skip to content

Commit

Permalink
webrtc: fix propagating query parameters when appending slash to paths (
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Dec 1, 2023
1 parent 50e7b03 commit 4ccb245
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/core/webrtc_http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,11 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
s.onPage(ctx, ctx.Request.URL.Path[1:len(ctx.Request.URL.Path)-len("/publish")], true)

case ctx.Request.URL.Path[len(ctx.Request.URL.Path)-1] != '/':
ctx.Writer.Header().Set("Location", ctx.Request.URL.Path[1:]+"/")
l := ctx.Request.URL.Path[1:] + "/"
if ctx.Request.URL.RawQuery != "" {
l += "?" + ctx.Request.URL.RawQuery
}
ctx.Writer.Header().Set("Location", l)
ctx.Writer.WriteHeader(http.StatusMovedPermanently)

default:
Expand Down

0 comments on commit 4ccb245

Please sign in to comment.