Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
45483011
Commit
45483011
authored
May 21, 2013
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLS: resolve relative URLs (/a/b/../c -> /a/c)
parent
04632cc8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
11 deletions
+32
-11
modules/stream_filter/httplive.c
modules/stream_filter/httplive.c
+32
-11
No files found.
modules/stream_filter/httplive.c
View file @
45483011
...
@@ -542,28 +542,49 @@ static int string_to_IV(char *string_hexa, uint8_t iv[AES_BLOCK_SIZE])
...
@@ -542,28 +542,49 @@ static int string_to_IV(char *string_hexa, uint8_t iv[AES_BLOCK_SIZE])
static
char
*
relative_URI
(
const
char
*
psz_url
,
const
char
*
psz_path
)
static
char
*
relative_URI
(
const
char
*
psz_url
,
const
char
*
psz_path
)
{
{
char
*
ret
=
NULL
;
assert
(
psz_url
!=
NULL
&&
psz_path
!=
NULL
);
assert
(
psz_url
!=
NULL
&&
psz_path
!=
NULL
);
//If the path is actually an absolute URL, don't do anything.
//If the path is actually an absolute URL, don't do anything.
if
(
strncmp
(
psz_path
,
"http"
,
4
)
==
0
)
if
(
strncmp
(
psz_path
,
"http"
,
4
)
==
0
)
return
NULL
;
return
NULL
;
char
*
path_separator
=
NULL
;
size_t
len
=
strlen
(
psz_path
);
char
*
new_url
=
strdup
(
psz_url
);
if
(
unlikely
(
!
new_url
))
return
NULL
;
if
(
psz_path
[
0
]
==
'/'
)
//Relative URL with absolute path
if
(
psz_path
[
0
]
==
'/'
)
//Relative URL with absolute path
{
{
//Try to find separator for name and path, try to skip
//Try to find separator for name and path, try to skip
//access and first ://
//access and first ://
path_separator
=
strchr
(
&
psz_url
[
8
],
'/'
);
char
*
slash
=
strchr
(
&
new_url
[
8
],
'/'
);
if
(
unlikely
(
slash
==
NULL
))
goto
end
;
*
slash
=
'\0'
;
}
else
{
}
else
{
path_separator
=
strrchr
(
psz_url
,
'/'
);
int
levels
=
0
;
while
(
len
>=
3
&&
!
strncmp
(
psz_path
,
"../"
,
3
))
{
psz_path
+=
3
;
len
-=
3
;
levels
++
;
}
}
if
(
unlikely
(
path_separator
==
NULL
)
)
do
{
return
NULL
;
char
*
slash
=
strrchr
(
new_url
,
'/'
);
const
size_t
url_length
=
path_separator
-
psz_url
+
1
;
if
(
unlikely
(
slash
==
NULL
))
char
*
psz_res
=
malloc
(
url_length
+
strlen
(
psz_path
)
+
1
);
goto
end
;
strncpy
(
psz_res
,
psz_url
,
url_length
);
*
slash
=
'\0'
;
psz_res
[
url_length
]
=
0
;
}
while
(
levels
--
);
strcat
(
psz_res
,
psz_path
);
}
return
psz_res
;
if
(
asprintf
(
&
ret
,
"%s/%s"
,
new_url
,
psz_path
)
<
0
)
ret
=
NULL
;
end:
free
(
new_url
);
return
ret
;
}
}
static
int
parse_SegmentInformation
(
hls_stream_t
*
hls
,
char
*
p_read
,
int
*
duration
)
static
int
parse_SegmentInformation
(
hls_stream_t
*
hls
,
char
*
p_read
,
int
*
duration
)
...
...
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