set_subcategory( SUBCAT_INPUT_ACCESS )
add_integer( "ftp-caching", 2 * DEFAULT_PTS_DELAY / 1000, NULL,
CACHING_TEXT, CACHING_LONGTEXT, true )
+ change_safe()
add_string( "ftp-user", "anonymous", NULL, USER_TEXT, USER_LONGTEXT,
false )
add_string( "ftp-pwd", "anonymous@example.com", NULL, PASS_TEXT,
set_capability( "sout access", 0 )
set_category( CAT_SOUT )
set_subcategory( SUBCAT_SOUT_ACO )
+ add_shortcut( "ftp" )
set_callbacks( OutOpen, OutClose )
vlc_module_end ()
if( url->i_port <= 0 )
url->i_port = IPPORT_FTP; /* default port */
- /* FTP URLs are relative to user's default directory (RFC1738)
+ /* FTP URLs are relative to user's default directory (RFC1738 ยง3.2)
For absolute path use ftp://foo.bar//usr/local/etc/filename */
-
+ /* FIXME: we should issue a series of CWD, one per slash */
if( url->psz_path && *url->psz_path == '/' )
url->psz_path++;
+ char *type = strstr( url->psz_path, ";type=" );
+ if( type )
+ {
+ *type = '\0';
+ if( strchr( "iI", type[6] ) == NULL )
+ return VLC_EGENERIC; /* ASCII and directory not supported */
+ }
+ decode_URI( url->psz_path );
return VLC_SUCCESS;
}
goto exit_error;
/* get size */
- if( ftp_SendCommand( p_this, p_sys, "SIZE %s", p_sys->url.psz_path ? : "" ) < 0 ||
- ftp_ReadCommand( p_this, p_sys, NULL, &psz_arg ) != 2 )
+ if( ftp_SendCommand( p_this, p_sys, "SIZE %s", p_sys->url.psz_path
+ ? p_sys->url.psz_path : "" ) < 0
+ || ftp_ReadCommand( p_this, p_sys, NULL, &psz_arg ) != 2 )
{
msg_Dbg( p_access, "cannot get file size" );
msg_Dbg( p_access, "will try to get directory contents" );
- if( ftp_SendCommand( p_this, p_sys, "CWD %s", p_sys->url.psz_path ?: "" ) < 0 ||
+ if( ftp_SendCommand( p_this, p_sys, "CWD %s", p_sys->url.psz_path
+ ? p_sys->url.psz_path : "" ) < 0 ||
ftp_ReadCommand( p_this, p_sys, NULL, &psz_arg ) != 2 )
{
msg_Err( p_access, "file or directory doesn't exist" );
/* "1xx" message */
if( ftp_SendCommand( p_access, p_sys, "%s %s",
p_sys->out ? "STOR" : "RETR",
- p_sys->url.psz_path ?: "" ) < 0 ||
- ftp_ReadCommand( p_access, p_sys, &i_answer, NULL ) > 2 )
+ p_sys->url.psz_path ? p_sys->url.psz_path : "" ) < 0
+ || ftp_ReadCommand( p_access, p_sys, &i_answer, NULL ) > 2 )
{
msg_Err( p_access, "cannot retrieve file" );
return VLC_EGENERIC;