Handle RTSP session id properly.
Issue: #9254 #minor-release We used to allow only alphanumerical characters in session id. The spec also allows "$", "-", "_", ".", "+" (RFC2326 Sections 3.4 and 15.1). PiperOrigin-RevId: 388873742
This commit is contained in:
parent
2946cbe190
commit
a5cbd9f6c2
@ -142,6 +142,8 @@
|
|||||||
([#9182](https://github.com/google/ExoPlayer/issues/9182)).
|
([#9182](https://github.com/google/ExoPlayer/issues/9182)).
|
||||||
* Handle an extra semicolon in SDP fmtp attribute
|
* Handle an extra semicolon in SDP fmtp attribute
|
||||||
([#9247](https://github.com/google/ExoPlayer/pull/9247)).
|
([#9247](https://github.com/google/ExoPlayer/pull/9247)).
|
||||||
|
* Fix handling of special characters in the RTSP session ID
|
||||||
|
([#9254](https://github.com/google/ExoPlayer/issues/9254)).
|
||||||
* MediaSession extension:
|
* MediaSession extension:
|
||||||
* Deprecate `setControlDispatcher` in `MediaSessionConnector`. The
|
* Deprecate `setControlDispatcher` in `MediaSessionConnector`. The
|
||||||
`ControlDispatcher` parameter has also been deprecated in all
|
`ControlDispatcher` parameter has also been deprecated in all
|
||||||
|
@ -92,9 +92,9 @@ import java.util.regex.Pattern;
|
|||||||
private static final Pattern CONTENT_LENGTH_HEADER_PATTERN =
|
private static final Pattern CONTENT_LENGTH_HEADER_PATTERN =
|
||||||
Pattern.compile("Content-Length:\\s?(\\d+)", CASE_INSENSITIVE);
|
Pattern.compile("Content-Length:\\s?(\\d+)", CASE_INSENSITIVE);
|
||||||
|
|
||||||
// Session header pattern, see RFC2326 Section 12.37.
|
// Session header pattern, see RFC2326 Sections 3.4 and 12.37.
|
||||||
private static final Pattern SESSION_HEADER_PATTERN =
|
private static final Pattern SESSION_HEADER_PATTERN =
|
||||||
Pattern.compile("(\\w+)(?:;\\s?timeout=(\\d+))?");
|
Pattern.compile("([\\w$-_.+]+)(?:;\\s?timeout=(\\d+))?");
|
||||||
|
|
||||||
// WWW-Authenticate header pattern, see RFC2068 Sections 14.46 and RFC2069.
|
// WWW-Authenticate header pattern, see RFC2068 Sections 14.46 and RFC2069.
|
||||||
private static final Pattern WWW_AUTHENTICATION_HEADER_DIGEST_PATTERN =
|
private static final Pattern WWW_AUTHENTICATION_HEADER_DIGEST_PATTERN =
|
||||||
|
@ -350,6 +350,15 @@ public final class RtspMessageUtilTest {
|
|||||||
.isEqualTo(expectedRtspMessage.getBytes(RtspMessageChannel.CHARSET));
|
.isEqualTo(expectedRtspMessage.getBytes(RtspMessageChannel.CHARSET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void parseSessionHeader_withSessionIdContainingSpecialCharacters_succeeds()
|
||||||
|
throws Exception {
|
||||||
|
String sessionHeaderString = "610a63df-9b57.4856_97ac$665f+56e9c04";
|
||||||
|
RtspMessageUtil.RtspSessionHeader sessionHeader =
|
||||||
|
RtspMessageUtil.parseSessionHeader(sessionHeaderString);
|
||||||
|
assertThat(sessionHeader.sessionId).isEqualTo("610a63df-9b57.4856_97ac$665f+56e9c04");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void removeUserInfo_withUserInfo() {
|
public void removeUserInfo_withUserInfo() {
|
||||||
Uri uri = Uri.parse("rtsp://user:pass@foo.bar/foo.mkv");
|
Uri uri = Uri.parse("rtsp://user:pass@foo.bar/foo.mkv");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user