You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Asankha C. Perera" <as...@wso2.com> on 2007/08/29 11:00:36 UTC

Specifying options to FTP etc..

Hi all

I am trying to use VFS to connect to a FTP file, but the problem is that 
I cannot specify that PASSIVE mode should be used. I think we could use 
the format below to specify for example: ?passive=true etc.

ftp://myusername:mypassword@somehost/pub/downloads/somefile.tgz?option=value

Have I missed something to get passive mode specified via the URI or can 
we assume the above to be a good solution?

thanks
asankha

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [vfs] Re: Specifying options to FTP etc..

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!  
> I think we should leave it upto the scheme to decide. So http may
> decide to pass it to the server, while ftp may decide to use it to
> talk to the server. i.e. each implementation will know the options
> they understand, enforce them and pass any remainder to the server.
> How does that sound?
It sounds complicated ... :-(

We have to parse all the url parameters and use a special naming scheme
to avoid naming clashes,no?
I am not convinced that this is a good idea - you have to deal with all
the url encoding stuff etc.. maybe even with the charset - which is also
a FileSystemOption for some filesystems.



Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [vfs] Re: Specifying options to FTP etc..

Posted by "Asankha C. Perera" <as...@wso2.com>.
Hi Mario
>> I don't quite agree with this - this may be the common case for HTTP,
>> but the URI spec does not enforce it.
>>     
> Ok, but how should we differentiate between these both use-cases?
>   
I think we should leave it upto the scheme to decide. So http may decide 
to pass it to the server, while ftp may decide to use it to talk to the 
server. i.e. each implementation will know the options they understand, 
enforce them and pass any remainder to the server. How does that sound?

Also this seems to be perfectly valid with the specs

RFC 1738; FTP (see also RFC959)

ftpurl         = "ftp://" login [ "/" fpath [ ";type=" ftptype ]]
fpath          = fsegment *[ "/" fsegment ]
fsegment       = *[ uchar | "?" | ":" | "@" | "&" | "=" ]
ftptype        = "A" | "I" | "D" | "a" | "i" | "d"

There is already type=ftptype in use to indicate information about the 
transfer, thus I believe indicating to use passive ftp belongs to the 
same category i.e. ?passive=true
> and we separate the VFS configuration using the double question-mark (??)
>
> A url like:
> http://www/path/cgi-bin/send.pl?FILE=ABC&TYPE=PDF??proxyHost=proxy.host&proxyPort=8080
>
> will work then.
>   
I don't think that ("?" followed by "??") adheres to the spec though..

thanks
asankha

Re: [vfs] Re: Specifying options to FTP etc..

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> I think the use of the ?? would not be a good URI scheme. However, maybe we
> could simply make the VFS parameters unique. For example add vfs. in front
> of them. 
>
> For example, 
> http://www/path/cgi-bin/send.pl?FILE=ABC&TYPE=PDF&vfs.proxyHost=proxy.host&vfs.proxyPort=8080
>   
Yes, for sure, this could make it too - I thought about it too. Even if
I am still not that happy with this query-string parsing/repacking stuff
I'd commit it if someone contributes a patch.

I'll help with dealing with the details, but have not much time to do it
myself yet.
We have to figure out:
* do we rely on url-escape strings with this url parameters too? (I'd
say no - except for the "&" character itself)
* if we do - how to deal with the used charset? (I'd say we expect them
to be in UTF-8 then, regardless of the charset of the other parameters)
* do we strip these parameters off so that we have a query string
without these special fields when sending to the remote host? (I'd say yes)
* enhance the filename so that we have the queryString (as now) and a
remoteQueryString which will be passed to the remote server
* use the new remoteQueryString e.g. with the http filesystem
implementation.


It would be great if someone could open a JIRA ticket at least that we
don't loose the request.

Thanks!
Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [vfs] Re: Specifying options to FTP etc..

Posted by pizak <pa...@fremantle.org>.
Mario

I think the use of the ?? would not be a good URI scheme. However, maybe we
could simply make the VFS parameters unique. For example add vfs. in front
of them. 

For example, 
http://www/path/cgi-bin/send.pl?FILE=ABC&TYPE=PDF&vfs.proxyHost=proxy.host&vfs.proxyPort=8080

or 

ftp:/fremantle.org/file?vfs.passive.ftp=true

Paul

Mario Ivankovits wrote:
> 
> Hi! 
>> I don't quite agree with this - this may be the common case for HTTP,
>> but the URI spec does not enforce it.
> Ok, but how should we differentiate between these both use-cases?
> 
> If we would like to allow this style of URL we need some special
> delimiter to know what to pass to VFS as configuration and what to pass
> further to the server.
> And no - I don't want to care if we are using the HTTP or any other
> scheme.
> 
> Hmmm ..... what we can do might be something like this.
> 
> We add a new resolveFile method to the FileSystemManager interface:
> FileObject resolveFileWithUrlConfiguration(String uri)
> 
> and we separate the VFS configuration using the double question-mark (??)
> 
> A url like:
> http://www/path/cgi-bin/send.pl?FILE=ABC&TYPE=PDF??proxyHost=proxy.host&proxyPort=8080
> 
> will work then.
> 
> resolveFileWithUrlConfiguration will strip the part after (including) ??
> and create the FileSystemOption stuff (if possible) which means the vfs
> configuration string will not be shown in the filename.
> 
> Then
> FileObject fo = manager.resolveFileWithUrlConfiguration(....);
> FileObject fo2 =
> manager.resolveFileWithUrlConfiguration(fo.getName().toString);
> 
> will not use the same filesystem configuration.
> 
> This limitation makes it look a little bit hacky - we might remove this
> limitation later.
> 
> 
> What do you think?
> 
> Ciao,
> Mario
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Specifying-options-to-FTP-etc..-tf4346550.html#a12492674
Sent from the Commons - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


[vfs] Re: Specifying options to FTP etc..

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi! 
> I don't quite agree with this - this may be the common case for HTTP,
> but the URI spec does not enforce it.
Ok, but how should we differentiate between these both use-cases?

If we would like to allow this style of URL we need some special
delimiter to know what to pass to VFS as configuration and what to pass
further to the server.
And no - I don't want to care if we are using the HTTP or any other scheme.

Hmmm ..... what we can do might be something like this.

We add a new resolveFile method to the FileSystemManager interface:
FileObject resolveFileWithUrlConfiguration(String uri)

and we separate the VFS configuration using the double question-mark (??)

A url like:
http://www/path/cgi-bin/send.pl?FILE=ABC&TYPE=PDF??proxyHost=proxy.host&proxyPort=8080

will work then.

resolveFileWithUrlConfiguration will strip the part after (including) ??
and create the FileSystemOption stuff (if possible) which means the vfs
configuration string will not be shown in the filename.

Then
FileObject fo = manager.resolveFileWithUrlConfiguration(....);
FileObject fo2 =
manager.resolveFileWithUrlConfiguration(fo.getName().toString);

will not use the same filesystem configuration.

This limitation makes it look a little bit hacky - we might remove this
limitation later.


What do you think?

Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: Specifying options to FTP etc..

Posted by Sergey Vladimirov <vl...@gmail.com>.
Good day, Mario.

+1 vote from me.
This is very common case, when deleveloper allows user to specify URI only.

More over, this setting is file-specific (or, more precisely, site
specific), so it's not always correct to set them up using
ConfigurationBuilder.

Another example is to add "classloader" parameter to ResourceFileSystem's
URIs, which specifies classloader to use: "thread" for current thread one,
"vfs" for ResourceFileSystem.class.getClassLoader() or "system" for system
class loader.

-- 
Bets regards,
Sergey.

2007/8/29, Asankha C. Perera <as...@wso2.com>:
>
> Hi Mario
>
> > It is possible through the *FileSystemConfigurationBuilder stuff only.
> >
> Unfortunately this does not work for me, as I can only specify a VFS
> URI. So VFS needs to figure out and make it happen in my case
> >>
> ftp://myusername:mypassword@somehost/pub/downloads/somefile.tgz?option=value
> >>
> >>
> >> Have I missed something to get passive mode specified via the URI or
> >> can we assume the above to be a good solution?
> >>
> >
> > I don't think that adding them as option to the URI is a good idea as
> > the URI parameters are meant to be processed by the destination (e.g. an
> > http server) and not by VFS.
> >
> I don't quite agree with this - this may be the common case for HTTP,
> but the URI spec does not enforce it.
> /
> /_http://www.w3.org/Addressing/URL/4_URI_Recommentations.html:_/
> "The query string represents some operation applied to the object, but
> this specification gives no common syntax or semantics for it. In
> practice the syntax and sematics may depend on the scheme and may even
> on the base URI."/
>
> Also there are IRI schemes that specify such parameters already. Ref the
> JMS scheme here
> <
> http://mail-archives.apache.org/mod_mbox/ws-axis-dev/200701.mbox/raw/%3C80A43FC052CE3949A327527DCD5D6B27020FB65C@MAIL01.bedford.progress.com%3E/2
> >
>
> thanks
> asankha
>



-- 
Sergey Vladimirov

Re: Specifying options to FTP etc..

Posted by "Asankha C. Perera" <as...@wso2.com>.
Hi Mario

> It is possible through the *FileSystemConfigurationBuilder stuff only.
>   
Unfortunately this does not work for me, as I can only specify a VFS 
URI. So VFS needs to figure out and make it happen in my case
>> ftp://myusername:mypassword@somehost/pub/downloads/somefile.tgz?option=value
>>
>>
>> Have I missed something to get passive mode specified via the URI or
>> can we assume the above to be a good solution?
>>     
>
> I don't think that adding them as option to the URI is a good idea as
> the URI parameters are meant to be processed by the destination (e.g. an
> http server) and not by VFS.
>   
I don't quite agree with this - this may be the common case for HTTP, 
but the URI spec does not enforce it.
/
/_http://www.w3.org/Addressing/URL/4_URI_Recommentations.html:_/
"The query string represents some operation applied to the object, but 
this specification gives no common syntax or semantics for it. In 
practice the syntax and sematics may depend on the scheme and may even 
on the base URI."/

Also there are IRI schemes that specify such parameters already. Ref the 
JMS scheme here 
<http://mail-archives.apache.org/mod_mbox/ws-axis-dev/200701.mbox/raw/%3C80A43FC052CE3949A327527DCD5D6B27020FB65C@MAIL01.bedford.progress.com%3E/2>

thanks
asankha

Re: Specifying options to FTP etc..

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> I am trying to use VFS to connect to a FTP file, but the problem is
> that I cannot specify that PASSIVE mode should be used.
It is possible through the *FileSystemConfigurationBuilder stuff only.

> ftp://myusername:mypassword@somehost/pub/downloads/somefile.tgz?option=value
>
>
> Have I missed something to get passive mode specified via the URI or
> can we assume the above to be a good solution?

I don't think that adding them as option to the URI is a good idea as
the URI parameters are meant to be processed by the destination (e.g. an
http server) and not by VFS.

Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org