Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
7e1180d8
Commit
7e1180d8
authored
Sep 17, 2011
by
Pierre Ynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
access_http: support comments (parentheses) in user-agent
parent
adc35019
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
modules/access/http.c
modules/access/http.c
+28
-3
No files found.
modules/access/http.c
View file @
7e1180d8
...
...
@@ -53,6 +53,7 @@
#endif
#include <assert.h>
#include <limits.h>
#ifdef HAVE_LIBPROXY
# include <proxy.h>
...
...
@@ -320,16 +321,40 @@ static int OpenWithCookies( vlc_object_t *p_this, const char *psz_access,
}
/* Determine the HTTP user agent */
/* See RFC2616 §2.2 token definition and §3.8 user-agent header */
/* See RFC2616 §2.2 token and comment definition, and §3.8 and
* §14.43 user-agent header */
p_sys
->
psz_user_agent
=
var_InheritString
(
p_access
,
"http-user-agent"
);
if
(
p_sys
->
psz_user_agent
)
{
unsigned
comment_level
=
0
;
for
(
char
*
p
=
p_sys
->
psz_user_agent
;
*
p
;
p
++
)
{
uint8_t
c
=
*
p
;
if
(
c
<
32
||
strchr
(
"()<>@,;:
\\\"
[]?={}"
,
c
)
)
if
(
comment_level
==
0
)
{
if
(
c
<
32
||
strchr
(
")<>@,;:
\\\"
[]?={}"
,
c
)
)
*
p
=
'_'
;
/* remove potentially harmful characters */
}
else
{
if
(
c
==
')'
)
comment_level
--
;
else
if
(
c
<
32
&&
strchr
(
"
\t\r\n
"
,
c
)
==
NULL
)
*
p
=
'_'
;
/* remove potentially harmful characters */
}
if
(
c
==
'('
)
{
if
(
comment_level
==
UINT_MAX
)
break
;
comment_level
++
;
}
}
/* truncate evil unclosed comments */
if
(
comment_level
>
0
)
{
char
*
p
=
strchr
(
p_sys
->
psz_user_agent
,
'('
);
*
p
=
'\0'
;
}
}
/* HTTP referrer */
...
...
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