Browse Source

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

pull/2405/head
Alessandro Ros 2 years ago committed by GitHub
parent
commit
f1e28d053f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      internal/core/webrtc_http_server.go
  2. 2
      internal/core/webrtc_publish_index.html
  3. 2
      internal/core/webrtc_read_index.html
  4. 2
      internal/core/webrtc_source_test.go
  5. 4
      internal/whip/post_offer.go

4
internal/core/webrtc_http_server.go

@ -262,8 +262,8 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) { @@ -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)

2
internal/core/webrtc_publish_index.html

@ -346,7 +346,7 @@ class Transmitter { @@ -346,7 +346,7 @@ class Transmitter {
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({

2
internal/core/webrtc_read_index.html

@ -155,7 +155,7 @@ class WHEPClient { @@ -155,7 +155,7 @@ class WHEPClient {
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({

2
internal/core/webrtc_source_test.go

@ -88,7 +88,7 @@ func TestWebRTCSource(t *testing.T) { @@ -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))

4
internal/whip/post_offer.go

@ -53,9 +53,9 @@ func PostOffer( @@ -53,9 +53,9 @@ func PostOffer(
Location := res.Header.Get("Location")
etag := res.Header.Get("E-Tag")
etag := res.Header.Get("ETag")
if etag == "" {
return nil, fmt.Errorf("E-Tag is missing")
return nil, fmt.Errorf("ETag is missing")
}
sdp, err := io.ReadAll(res.Body)

Loading…
Cancel
Save