Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
212e37f8
authored
Sep 16, 2021
by
claincly
Committed by
Christos Tsilopoulos
Sep 16, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix RTSP WWW-Authenticate header parsing.
Issue: #9428 PiperOrigin-RevId: 397064086
parent
dfc29fc3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
RELEASENOTES.md
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspMessageUtil.java
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/RtspMessageUtilTest.java
RELEASENOTES.md
View file @
212e37f8
...
@@ -48,6 +48,8 @@
...
@@ -48,6 +48,8 @@
(
[
#9346
](
https://github.com/google/ExoPlayer/issues/9346
)
).
(
[
#9346
](
https://github.com/google/ExoPlayer/issues/9346
)
).
*
Fix RTSP Session header handling
*
Fix RTSP Session header handling
(
[
#9416
](
https://github.com/google/ExoPlayer/issues/9416
)
).
(
[
#9416
](
https://github.com/google/ExoPlayer/issues/9416
)
).
*
Fix RTSP WWW-Authenticate header parsing
(
[
#9428
](
https://github.com/google/ExoPlayer/issues/9428
)
).
*
UI:
*
UI:
*
Use
`defStyleAttr`
when obtaining styled attributes in
*
Use
`defStyleAttr`
when obtaining styled attributes in
`StyledPlayerView`
,
`PlayerView`
and
`PlayerControlView`
`StyledPlayerView`
,
`PlayerView`
and
`PlayerControlView`
...
...
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspMessageUtil.java
View file @
212e37f8
...
@@ -99,13 +99,13 @@ import java.util.regex.Pattern;
...
@@ -99,13 +99,13 @@ import java.util.regex.Pattern;
// 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
=
Pattern
.
compile
(
Pattern
.
compile
(
"Digest realm=\"([
\\w\\s@.
]+)\""
"Digest realm=\"([
^\"\\x00-\\x08\\x0A-\\x1f\\x7f
]+)\""
+
",\\s?(?:domain=\"(.+)\"
,\\s?)?
"
+
",\\s?(?:domain=\"(.+)\""
+
"
nonce=\"(\\w
+)\""
+
"
,\\s?)?nonce=\"([^\"\\x00-\\x08\\x0A-\\x1f\\x7f]
+)\""
+
"(?:,\\s?opaque=\"(
\\w
+)\")?"
);
+
"(?:,\\s?opaque=\"(
[^\"\\x00-\\x08\\x0A-\\x1f\\x7f]
+)\")?"
);
// WWW-Authenticate header pattern, see RFC2068 Section 11.1 and RFC2069.
// WWW-Authenticate header pattern, see RFC2068 Section 11.1 and RFC2069.
private
static
final
Pattern
WWW_AUTHENTICATION_HEADER_BASIC_PATTERN
=
private
static
final
Pattern
WWW_AUTHENTICATION_HEADER_BASIC_PATTERN
=
Pattern
.
compile
(
"Basic realm=\"([
\\w\\s@.
]+)\""
);
Pattern
.
compile
(
"Basic realm=\"([
^\"\\x00-\\x08\\x0A-\\x1f\\x7f
]+)\""
);
private
static
final
String
RTSP_VERSION
=
"RTSP/1.0"
;
private
static
final
String
RTSP_VERSION
=
"RTSP/1.0"
;
private
static
final
String
LF
=
new
String
(
new
byte
[]
{
Ascii
.
LF
});
private
static
final
String
LF
=
new
String
(
new
byte
[]
{
Ascii
.
LF
});
...
...
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/RtspMessageUtilTest.java
View file @
212e37f8
...
@@ -452,10 +452,10 @@ public final class RtspMessageUtilTest {
...
@@ -452,10 +452,10 @@ public final class RtspMessageUtilTest {
@Test
@Test
public
void
parseWWWAuthenticateHeader_withBasicAuthentication_succeeds
()
throws
Exception
{
public
void
parseWWWAuthenticateHeader_withBasicAuthentication_succeeds
()
throws
Exception
{
RtspAuthenticationInfo
authenticationInfo
=
RtspAuthenticationInfo
authenticationInfo
=
RtspMessageUtil
.
parseWwwAuthenticateHeader
(
"Basic realm=\"WallyWorld\""
);
RtspMessageUtil
.
parseWwwAuthenticateHeader
(
"Basic realm=\"Wally
-
World\""
);
assertThat
(
authenticationInfo
.
authenticationMechanism
).
isEqualTo
(
RtspAuthenticationInfo
.
BASIC
);
assertThat
(
authenticationInfo
.
authenticationMechanism
).
isEqualTo
(
RtspAuthenticationInfo
.
BASIC
);
assertThat
(
authenticationInfo
.
nonce
).
isEmpty
();
assertThat
(
authenticationInfo
.
nonce
).
isEmpty
();
assertThat
(
authenticationInfo
.
realm
).
isEqualTo
(
"WallyWorld"
);
assertThat
(
authenticationInfo
.
realm
).
isEqualTo
(
"Wally
-
World"
);
}
}
@Test
@Test
...
@@ -463,13 +463,13 @@ public final class RtspMessageUtilTest {
...
@@ -463,13 +463,13 @@ public final class RtspMessageUtilTest {
throws
Exception
{
throws
Exception
{
RtspAuthenticationInfo
authenticationInfo
=
RtspAuthenticationInfo
authenticationInfo
=
RtspMessageUtil
.
parseWwwAuthenticateHeader
(
RtspMessageUtil
.
parseWwwAuthenticateHeader
(
"Digest realm=\"testrealm@host.com\", domain=\"host.com\","
"Digest realm=\"test
-
realm@host.com\", domain=\"host.com\","
+
" nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+
" nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+
" opaque=\"5ccc069c403ebaf9f0171e9517f40e41\""
);
+
" opaque=\"5ccc069c403ebaf9f0171e9517f40e41\""
);
assertThat
(
authenticationInfo
.
authenticationMechanism
).
isEqualTo
(
RtspAuthenticationInfo
.
DIGEST
);
assertThat
(
authenticationInfo
.
authenticationMechanism
).
isEqualTo
(
RtspAuthenticationInfo
.
DIGEST
);
assertThat
(
authenticationInfo
.
nonce
).
isEqualTo
(
"dcd98b7102dd2f0e8b11d0f600bfb0c093"
);
assertThat
(
authenticationInfo
.
nonce
).
isEqualTo
(
"dcd98b7102dd2f0e8b11d0f600bfb0c093"
);
assertThat
(
authenticationInfo
.
realm
).
isEqualTo
(
"testrealm@host.com"
);
assertThat
(
authenticationInfo
.
realm
).
isEqualTo
(
"test
-
realm@host.com"
);
assertThat
(
authenticationInfo
.
opaque
).
isEmpty
();
assertThat
(
authenticationInfo
.
opaque
).
isEmpty
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment