[jcifs] SMB URL

Christopher R. Hertel crh at ubiqx.mn.org
Wed Jul 10 13:38:00 EST 2002

On Tue, Jul 09, 2002 at 11:05:12PM -0400, Allen, Michael B (RSCH) wrote:
> > If the latter was what was intended, then we would need to write:
> > 
> >   smb://foo%40bar/
> > 
> > ...and we're right back where we started from.
> > 
>       Nope. In this case you know what needs to be reencoded (the '@').
>       In the case of a NetBIOS name with the extra bit of information
>       stuffed into that 2E escape, if you loose it's gone. You can't get
>       it back and *you will not know which dot to reencode*.

Why wouldn't you?

If you have "smb://foo%2Ebar.snu.edu/" you would parse that into:

       prefix: smb
  netbiosname: foo.bar
        scope: snu.edu

You know that a dot isn't allowed when displaying the NetBIOS name, so you 
would know to escape it when rebuilding the URL string.

The thing is that you don't know right away if the name is a NetBIOS name 
or a DNS name.  One way to work around that is to parse it as:

       prefix: smb
  netbiosname: foo.bar
        scope: snu.edu
         host: foo.bar.snu.edu

(I'm using the RFC's meaning of the term 'host' here, not the meaning the 
Java URL class docs use.)

Once you've done the queries to determine which kind of name it is, you 
might delete the invalid interpretation or perhaps have some internal flag 
indicating which type of 'host' the string represents.

I looked at the Java URLEncoder class docs too.  That would encode just 
about anything that wasn't alpha-numeric.  Probably more than you'd want 
to do in working code.

Chris -)-----

Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org

More information about the jcifs mailing list