Carriage return character sometimes missing in SDP c-line
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Oct 2019 19:03:44 +0000 (19:03 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Oct 2019 19:03:44 +0000 (19:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=203190

Reviewed by Eric Carlson.

Source/WebCore:

Covered by updated test.

* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::filterSDP const):
Add missing\r when filterig the c line.

LayoutTests:

* webrtc/datachannel/filter-ice-candidate.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251442 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/webrtc/datachannel/filter-ice-candidate.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp

index 9ffb73d..c052e01 100644 (file)
@@ -1,3 +1,12 @@
+2019-10-22  youenn fablet  <youenn@apple.com>
+
+        Carriage return character sometimes missing in SDP c-line
+        https://bugs.webkit.org/show_bug.cgi?id=203190
+
+        Reviewed by Eric Carlson.
+
+        * webrtc/datachannel/filter-ice-candidate.html:
+
 2019-10-22  Russell Epstein  <repstein@apple.com>
 
         Layout Test imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https.html is a flaky failure
index 96937b7..0e0c4e1 100644 (file)
@@ -24,10 +24,10 @@ promise_test((test) => {
                 return;
             }
             assert_equals(pc.localDescription.sdp.indexOf("a=candidate"), -1);
-            assert_true(pc.localDescription.sdp.indexOf("c=IN IP4 0.0.0.0") != -1 || pc.localDescription.sdp.indexOf("c=IN IP6 ::") != -1);
+            assert_true(pc.localDescription.sdp.indexOf("c=IN IP4 0.0.0.0\r\n") != -1 || pc.localDescription.sdp.indexOf("c=IN IP6 ::\r\n") != -1);
             if (counter === 0) {
                 pc.createOffer().then((offer) => {
-                    assert_true(offer.sdp.indexOf("c=IN IP4 0.0.0.0") != -1 || pc.localDescription.sdp.indexOf("c=IN IP6 ::") != -1);
+                    assert_true(offer.sdp.indexOf("c=IN IP4 0.0.0.0\r\n") != -1 || pc.localDescription.sdp.indexOf("c=IN IP6 ::\r\n") != -1);
                     assert_equals(offer.sdp.indexOf("a=candidate"), -1);
                     resolve();
                 });
@@ -56,12 +56,12 @@ promise_test((test) => {
                 counter++;
                 return;
             }
-            assert_true(pc.localDescription.sdp.indexOf("c=IN IP4 0.0.0.0") == -1 && pc.localDescription.sdp.indexOf("c=IN IP6 ::") === -1);
+            assert_true(pc.localDescription.sdp.indexOf("c=IN IP4 0.0.0.0\r\n") === -1 && pc.localDescription.sdp.indexOf("c=IN IP6 ::\r\n") === -1);
             assert_false(pc.localDescription.sdp.indexOf("a=candidate") === -1);
             if (counter !== 0) {
                 // Redoing an offer now that we have some candidates.
                 pc.createOffer().then((offer) => {
-                    assert_true(offer.sdp.indexOf("c=IN IP4 0.0.0.0") == -1 && pc.localDescription.sdp.indexOf("c=IN IP6 ::") === -1);
+                    assert_true(offer.sdp.indexOf("c=IN IP4 0.0.0.0\r\n") === -1 && pc.localDescription.sdp.indexOf("c=IN IP6 ::\r\n") === -1);
                     assert_false(offer.sdp.indexOf("a=candidate") === -1);
                     resolve();
                 });
index 6ed0867..c3fc437 100644 (file)
@@ -1,5 +1,18 @@
 2019-10-22  youenn fablet  <youenn@apple.com>
 
+        Carriage return character sometimes missing in SDP c-line
+        https://bugs.webkit.org/show_bug.cgi?id=203190
+
+        Reviewed by Eric Carlson.
+
+        Covered by updated test.
+
+        * Modules/mediastream/PeerConnectionBackend.cpp:
+        (WebCore::PeerConnectionBackend::filterSDP const):
+        Add missing\r when filterig the c line.
+
+2019-10-22  youenn fablet  <youenn@apple.com>
+
         Remove mayHaveServiceWorkerRegisteredForOrigin
         https://bugs.webkit.org/show_bug.cgi?id=203055
 
index 2ff230e..0738db4 100644 (file)
@@ -422,9 +422,9 @@ String PeerConnectionBackend::filterSDP(String&& sdp) const
     StringBuilder filteredSDP;
     sdp.split('\n', [&filteredSDP](StringView line) {
         if (line.startsWith("c=IN IP4"))
-            filteredSDP.append("c=IN IP4 0.0.0.0");
+            filteredSDP.append("c=IN IP4 0.0.0.0\r");
         else if (line.startsWith("c=IN IP6"))
-            filteredSDP.append("c=IN IP6 ::");
+            filteredSDP.append("c=IN IP6 ::\r");
         else if (!line.startsWith("a=candidate"))
             filteredSDP.append(line);
         else if (line.find(" host ", 11) == notFound)