Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webrtc: fix ETag header name according to specification (#2396) #2401

Merged
merged 1 commit into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/core/webrtc_http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
}

ctx.Writer.Header().Set("Content-Type", "application/sdp")
ctx.Writer.Header().Set("Access-Control-Expose-Headers", "E-Tag, Accept-Patch, Link")
ctx.Writer.Header().Set("E-Tag", res.sx.secret.String())
ctx.Writer.Header().Set("Access-Control-Expose-Headers", "ETag, Accept-Patch, Link")
ctx.Writer.Header().Set("ETag", res.sx.secret.String())
ctx.Writer.Header().Set("ID", res.sx.uuid.String())
ctx.Writer.Header().Set("Accept-Patch", "application/trickle-ice-sdpfrag")
ctx.Writer.Header()["Link"] = whip.LinkHeaderMarshal(servers)
Expand Down
2 changes: 1 addition & 1 deletion internal/core/webrtc_publish_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@
if (res.status !== 201) {
throw new Error('bad status code');
}
this.eTag = res.headers.get('E-Tag');
this.eTag = res.headers.get('ETag');
return res.text();
})
.then((sdp) => this.onRemoteAnswer(new RTCSessionDescription({
Expand Down
2 changes: 1 addition & 1 deletion internal/core/webrtc_read_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
if (res.status !== 201) {
throw new Error('bad status code');
}
this.eTag = res.headers.get('E-Tag');
this.eTag = res.headers.get('ETag');
return res.text();
})
.then((sdp) => this.onRemoteAnswer(new RTCSessionDescription({
Expand Down
2 changes: 1 addition & 1 deletion internal/core/webrtc_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestWebRTCSource(t *testing.T) {

w.Header().Set("Content-Type", "application/sdp")
w.Header().Set("Accept-Patch", "application/trickle-ice-sdpfrag")
w.Header().Set("E-Tag", "test_etag")
w.Header().Set("ETag", "test_etag")
w.Header().Set("Location", "/my/resource/sessionid")
w.WriteHeader(http.StatusCreated)
w.Write([]byte(pc.LocalDescription().SDP))
Expand Down
4 changes: 2 additions & 2 deletions internal/whip/post_offer.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@

Location := res.Header.Get("Location")

etag := res.Header.Get("E-Tag")
etag := res.Header.Get("ETag")

Check warning on line 56 in internal/whip/post_offer.go

View check run for this annotation

Codecov / codecov/patch

internal/whip/post_offer.go#L56

Added line #L56 was not covered by tests
if etag == "" {
return nil, fmt.Errorf("E-Tag is missing")
return nil, fmt.Errorf("ETag is missing")

Check warning on line 58 in internal/whip/post_offer.go

View check run for this annotation

Codecov / codecov/patch

internal/whip/post_offer.go#L58

Added line #L58 was not covered by tests
}

sdp, err := io.ReadAll(res.Body)
Expand Down
Loading