Skip to content

Commit

Permalink
webrtc: fix ETag header name according to specification (#2396)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Sep 23, 2023
1 parent 75f518a commit a2df58f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
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 @@ func PostOffer(

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

0 comments on commit a2df58f

Please sign in to comment.