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
452f4020
Commit
452f4020
authored
May 10, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTTP: use DIR_SEP(_CHAR)
parent
7a0efcc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
31 deletions
+15
-31
modules/control/http/http.c
modules/control/http/http.c
+2
-9
modules/control/http/util.c
modules/control/http/util.c
+13
-22
No files found.
modules/control/http/http.c
View file @
452f4020
...
...
@@ -555,18 +555,11 @@ int HandlerCallback( httpd_handler_sys_t *p_args,
int
i_env
=
0
;
char
**
ppsz_env
=
NULL
;
char
*
psz_tmp
;
char
sep
;
size_t
i_buffer
;
char
*
p_buffer
;
char
*
psz_cwd
,
*
psz_file
=
NULL
;
int
i_ret
;
#ifdef WIN32
sep
=
'\\'
;
#else
sep
=
'/'
;
#endif
/* Create environment for the CGI */
TAB_APPEND
(
i_env
,
ppsz_env
,
strdup
(
"GATEWAY_INTERFACE=CGI/1.1"
)
);
TAB_APPEND
(
i_env
,
ppsz_env
,
strdup
(
"SERVER_PROTOCOL=HTTP/1.1"
)
);
...
...
@@ -677,7 +670,7 @@ int HandlerCallback( httpd_handler_sys_t *p_args,
}
}
psz_file
=
strrchr
(
p_args
->
file
.
file
,
sep
);
psz_file
=
strrchr
(
p_args
->
file
.
file
,
DIR_SEP_CHAR
);
if
(
psz_file
!=
NULL
)
{
psz_file
++
;
...
...
@@ -694,7 +687,7 @@ int HandlerCallback( httpd_handler_sys_t *p_args,
NULL
);
psz_tmp
=
strdup
(
p_args
->
file
.
file
);
p
=
strrchr
(
psz_tmp
,
sep
);
p
=
strrchr
(
psz_tmp
,
DIR_SEP_CHAR
);
if
(
p
!=
NULL
)
{
*
p
=
'\0'
;
...
...
modules/control/http/util.c
View file @
452f4020
...
...
@@ -120,14 +120,6 @@ int ParseDirectory( intf_thread_t *p_intf, char *psz_root,
int
i_dirlen
;
char
sep
;
#if defined( WIN32 )
sep
=
'\\'
;
#else
sep
=
'/'
;
#endif
if
(
(
p_dir
=
utf8_opendir
(
psz_dir
)
)
==
NULL
)
{
if
(
errno
!=
ENOENT
&&
errno
!=
ENOTDIR
)
...
...
@@ -145,7 +137,7 @@ int ParseDirectory( intf_thread_t *p_intf, char *psz_root,
msg_Dbg
(
p_intf
,
"dir=%s"
,
psz_dir
);
snprintf
(
dir
,
sizeof
(
dir
),
"%s
%c.access"
,
psz_dir
,
sep
);
snprintf
(
dir
,
sizeof
(
dir
),
"%s
"
DIR_SEP
".access"
,
psz_dir
);
if
(
(
file
=
utf8_fopen
(
dir
,
"r"
)
)
!=
NULL
)
{
char
line
[
1024
];
...
...
@@ -179,7 +171,7 @@ int ParseDirectory( intf_thread_t *p_intf, char *psz_root,
fclose
(
file
);
}
snprintf
(
dir
,
sizeof
(
dir
),
"%s
%c.hosts"
,
psz_dir
,
sep
);
snprintf
(
dir
,
sizeof
(
dir
),
"%s
"
DIR_SEP
".hosts"
,
psz_dir
);
p_acl
=
ACL_Create
(
p_intf
,
false
);
if
(
ACL_LoadFile
(
p_acl
,
dir
)
)
{
...
...
@@ -210,7 +202,7 @@ int ParseDirectory( intf_thread_t *p_intf, char *psz_root,
continue
;
}
snprintf
(
dir
,
sizeof
(
dir
),
"%s
%c%s"
,
psz_dir
,
sep
,
psz_filename
);
snprintf
(
dir
,
sizeof
(
dir
),
"%s
"
DIR_SEP
"%s"
,
psz_dir
,
psz_filename
);
free
(
psz_filename
);
if
(
ParseDirectory
(
p_intf
,
psz_root
,
dir
)
)
...
...
@@ -912,13 +904,12 @@ char *RealPath( const char *psz_src )
char
*
psz_dir
;
char
*
p
;
int
i_len
=
strlen
(
psz_src
);
const
char
sep
=
DIR_SEP_CHAR
;
psz_dir
=
malloc
(
i_len
+
2
);
strcpy
(
psz_dir
,
psz_src
);
/* Add a trailing sep to ease the .. step */
psz_dir
[
i_len
]
=
sep
;
psz_dir
[
i_len
]
=
DIR_SEP_CHAR
;
psz_dir
[
i_len
+
1
]
=
'\0'
;
#if (DIR_SEP_CHAR != '/')
...
...
@@ -926,18 +917,18 @@ char *RealPath( const char *psz_src )
p
=
psz_dir
;
while
(
(
p
=
strchr
(
p
,
'/'
))
!=
NULL
)
{
*
p
=
sep
;
*
p
=
DIR_SEP_CHAR
;
}
#endif
/* FIXME: this could be O(N) rather than O(N²)... */
/* Remove multiple separators and /./ */
p
=
psz_dir
;
while
(
(
p
=
strchr
(
p
,
sep
))
!=
NULL
)
while
(
(
p
=
strchr
(
p
,
DIR_SEP_CHAR
))
!=
NULL
)
{
if
(
p
[
1
]
==
sep
)
if
(
p
[
1
]
==
DIR_SEP_CHAR
)
memmove
(
&
p
[
1
],
&
p
[
2
],
strlen
(
&
p
[
2
])
+
1
);
else
if
(
p
[
1
]
==
'.'
&&
p
[
2
]
==
sep
)
else
if
(
p
[
1
]
==
'.'
&&
p
[
2
]
==
DIR_SEP_CHAR
)
memmove
(
&
p
[
1
],
&
p
[
3
],
strlen
(
&
p
[
3
])
+
1
);
else
p
++
;
...
...
@@ -955,13 +946,13 @@ char *RealPath( const char *psz_src )
{
/* Fix all .. dir */
p
=
psz_dir
+
3
;
while
(
(
p
=
strchr
(
p
,
sep
))
!=
NULL
)
while
(
(
p
=
strchr
(
p
,
DIR_SEP_CHAR
))
!=
NULL
)
{
if
(
p
[
-
1
]
==
'.'
&&
p
[
-
2
]
==
'.'
&&
p
[
-
3
]
==
sep
)
if
(
p
[
-
1
]
==
'.'
&&
p
[
-
2
]
==
'.'
&&
p
[
-
3
]
==
DIR_SEP_CHAR
)
{
char
*
q
;
p
[
-
3
]
=
'\0'
;
if
(
(
q
=
strrchr
(
psz_dir
,
sep
))
!=
NULL
)
if
(
(
q
=
strrchr
(
psz_dir
,
DIR_SEP_CHAR
))
!=
NULL
)
{
memmove
(
q
+
1
,
p
+
1
,
strlen
(
p
+
1
)
+
1
);
p
=
q
+
1
;
...
...
@@ -979,8 +970,8 @@ char *RealPath( const char *psz_src )
/* Remove trailing sep if there are at least 2 sep in the string
* (handles the C:\ stuff) */
p
=
strrchr
(
psz_dir
,
sep
);
if
(
p
!=
NULL
&&
p
[
1
]
==
'\0'
&&
p
!=
strchr
(
psz_dir
,
sep
)
)
p
=
strrchr
(
psz_dir
,
DIR_SEP_CHAR
);
if
(
p
!=
NULL
&&
p
[
1
]
==
'\0'
&&
p
!=
strchr
(
psz_dir
,
DIR_SEP_CHAR
)
)
*
p
=
'\0'
;
return
psz_dir
;
...
...
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