[jcifs] SMB URL

Christopher R. Hertel crh at ubiqx.mn.org
Wed Jul 10 07:11:18 EST 2002

Looking at java.net.URLEncoder and java.net.URLDecoder...

The encoder is very conservative.  It encodes just about everything.  That 
means that if you created an SMBURL class, as a descendant form of the URL 
class, the SMBURL class would need to parse the smb_srv_name field into 
it's component parts before applying any encoding or decoding.

That is fairly straight-forward, though.  Java.net.URL will parse out what
they call the "host" field (which is actually the server field, according
to RFC 2396).  The descendant SMBURL class can parse that into userinfo,
host, and port.  It can then determine syntactically whether the host
component is an IPv4 address, an IPv6 address or some kind of name.

Determining whether the name is a DNS name or a NetBIOS name with scopeID
attached is mostly a semantic problem.  I think that this is where the
problem is.  In most cases, there is no syntactic distinction between 
NetBIOS and DNS name syntax.  So, in order to determine which kind of name 
is in the host field, the application needs to try both the NetBIOS and 
DNS queries.

Thing is, this must be done even if the scope ID is contained in the 
?query string.  If you have:


You need to do a NetBIOS query for "FOO.BAR<20>" and "FOO.BAR<1D>" and 
possibly "FOO.BAR<1B>" as I described earlier.  You also need to do a DNS 
lookup for "FOO.BAR" (though why anyone would escape a dot in a DNS name 
is beyond me).

Bottom line:  I don't think we gain anything by removing the Scope ID from 
the authority component.

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