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
a62b01ec
Commit
a62b01ec
authored
Aug 21, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ftp: check if server supports
UTF-8
(fixes #2746)
parent
283669aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
14 deletions
+40
-14
modules/access/ftp.c
modules/access/ftp.c
+40
-14
No files found.
modules/access/ftp.c
View file @
a62b01ec
...
@@ -342,6 +342,23 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
...
@@ -342,6 +342,23 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
return
0
;
return
0
;
}
}
static
void
FeaturesCheck
(
void
*
opaque
,
const
char
*
feature
)
{
bool
*
unicode
=
opaque
;
if
(
strcasestr
(
feature
,
"UTF8"
)
!=
NULL
)
*
unicode
=
true
;
}
static
const
char
*
IsASCII
(
const
char
*
str
)
{
int8_t
c
;
for
(
const
char
*
p
=
str
;
(
c
=
*
p
)
!=
'\0'
;
p
++
)
if
(
c
<
0
)
return
NULL
;
return
str
;
}
static
int
Connect
(
vlc_object_t
*
p_access
,
access_sys_t
*
p_sys
)
static
int
Connect
(
vlc_object_t
*
p_access
,
access_sys_t
*
p_sys
)
{
{
if
(
Login
(
p_access
,
p_sys
)
<
0
)
if
(
Login
(
p_access
,
p_sys
)
<
0
)
...
@@ -351,17 +368,13 @@ static int Connect( vlc_object_t *p_access, access_sys_t *p_sys )
...
@@ -351,17 +368,13 @@ static int Connect( vlc_object_t *p_access, access_sys_t *p_sys )
if
(
ftp_SendCommand
(
p_access
,
p_sys
,
"EPSV ALL"
)
<
0
)
if
(
ftp_SendCommand
(
p_access
,
p_sys
,
"EPSV ALL"
)
<
0
)
{
{
msg_Err
(
p_access
,
"cannot request extended passive mode"
);
msg_Err
(
p_access
,
"cannot request extended passive mode"
);
net_Close
(
p_sys
->
fd_cmd
);
goto
error
;
return
-
1
;
}
}
if
(
ftp_RecvCommand
(
p_access
,
p_sys
,
NULL
,
NULL
)
==
2
)
if
(
ftp_RecvCommand
(
p_access
,
p_sys
,
NULL
,
NULL
)
==
2
)
{
{
if
(
net_GetPeerAddress
(
p_sys
->
fd_cmd
,
p_sys
->
sz_epsv_ip
,
NULL
)
)
if
(
net_GetPeerAddress
(
p_sys
->
fd_cmd
,
p_sys
->
sz_epsv_ip
,
NULL
)
)
{
goto
error
;
net_Close
(
p_sys
->
fd_cmd
);
return
-
1
;
}
}
}
else
else
{
{
...
@@ -374,10 +387,23 @@ static int Connect( vlc_object_t *p_access, access_sys_t *p_sys )
...
@@ -374,10 +387,23 @@ static int Connect( vlc_object_t *p_access, access_sys_t *p_sys )
net_Close
(
p_sys
->
fd_cmd
);
net_Close
(
p_sys
->
fd_cmd
);
if
(
Login
(
p_access
,
p_sys
)
)
if
(
Login
(
p_access
,
p_sys
)
)
{
goto
error
;
net_Close
(
p_sys
->
fd_cmd
);
}
return
-
1
;
}
/* features check */
bool
unicode
=
false
;
if
(
ftp_SendCommand
(
p_access
,
p_sys
,
"FEAT"
)
<
0
||
ftp_RecvAnswer
(
p_access
,
p_sys
,
NULL
,
NULL
,
FeaturesCheck
,
&
unicode
)
<
0
)
{
msg_Err
(
p_access
,
"cannot get server features"
);
goto
error
;
}
if
(
(
unicode
?
IsUTF8
:
IsASCII
)(
p_sys
->
url
.
psz_path
)
==
NULL
)
{
msg_Err
(
p_access
,
"unsupported path:
\"
%s
\"
"
,
p_sys
->
url
.
psz_path
);
goto
error
;
}
}
/* check binary mode support */
/* check binary mode support */
...
@@ -385,11 +411,13 @@ static int Connect( vlc_object_t *p_access, access_sys_t *p_sys )
...
@@ -385,11 +411,13 @@ static int Connect( vlc_object_t *p_access, access_sys_t *p_sys )
ftp_RecvCommand
(
p_access
,
p_sys
,
NULL
,
NULL
)
!=
2
)
ftp_RecvCommand
(
p_access
,
p_sys
,
NULL
,
NULL
)
!=
2
)
{
{
msg_Err
(
p_access
,
"cannot set binary transfer mode"
);
msg_Err
(
p_access
,
"cannot set binary transfer mode"
);
net_Close
(
p_sys
->
fd_cmd
);
goto
error
;
return
-
1
;
}
}
return
0
;
return
0
;
error:
net_Close
(
p_sys
->
fd_cmd
);
return
-
1
;
}
}
...
@@ -429,8 +457,6 @@ static int parseURL( vlc_url_t *url, const char *path )
...
@@ -429,8 +457,6 @@ static int parseURL( vlc_url_t *url, const char *path )
return
VLC_EGENERIC
;
/* ASCII and directory not supported */
return
VLC_EGENERIC
;
/* ASCII and directory not supported */
}
}
decode_URI
(
url
->
psz_path
);
decode_URI
(
url
->
psz_path
);
/* FIXME: check for UTF-8 support, otherwise only ASCII is allowed */
EnsureUTF8
(
url
->
psz_path
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
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