[jcifs] java.net.URL for SMB URL not quite right

Christopher R. Hertel crh at ubiqx.mn.org
Tue Oct 8 03:30:43 EST 2002


I need more time to look this through and understand the problem.  My 
knee-jerk reaction is to wonder about the SMB:// part.  It *might* be that 
the proper thing to store is just "SMB:", since there are URLs (eg 
mailto:) that don't use the double slashes.

One suggestion I had from the RFC authors was to use SMB:<workgroup> for 
the browser protocol and SMB://<server> for SMB itself.  I bring that up 
not to discuss the idea itself, but because it highlights my thinking on 
this.  It would seem to me that doing smb:// + foonet/ would be the wrong 
way to build a URL string, but that smb: + //foonet/ would be right.  That 
would explain the behavior of Sun's code.

Maybe.

As I said, I need to understand this better before I provide a "real" 
answer.  Don't count on *anything* above.  I'm just throwing some ideas at 
this point.  ...probably a dangerous thing to do.

Chris -)-----

On Mon, Oct 07, 2002 at 04:44:25AM -0400, Michael B. Allen wrote:
> The  java.net.URL class parses everything ok except for plain 'smb://' URLs
> and URLs derived from them. For example: 
> 
> smb://             --> smb:
> smb:// + foonet/   --> smb:/foonet/
> smb:// + //foonet/ --> smb://foonet/
> smb:////           --> smb://
> 
> You  can  see that this breaks the current model a bit. If a user creates a
> URL with 'smb://' the various java.net.URL.getXxx methods return: 
> 
>    authority: 
>         file: 
>         host: 
>         port: 139
>         path: 
>        query: null
>          ref: null
>     userinfo: null
> externalform: smb:
>       string: smb:
> 
> I  can override the arguments so that passing 'foonet/' is substituted with
> '//foonet/'  before  passing  it  to the default parser. That works ok, and
> makes  sense. I can trap the 'smb://' case and pass 'smb:////' too but this
> gives: 
> 
>    authority: 
>         file: //
>         host: 
>         port: 139
>         path: //
>        query: null
>          ref: null
>     userinfo: null
> externalform: smb://
>       string: smb://
> 
> As  you  can  see  this  hack makes the file and path '//' which makes less
> sense  to me. Does this behavior gibe with your draft and RFC 2396 Chris? I
> find  it  hard  to  believe Sun got it wrong. If java.net.URL is right then
> what should proper semantics be for SMB URLs? 
> 
> -- 
> A  program should be written to model the concepts of the task it
> performs rather than the physical world or a process because this
> maximizes  the  potential  for it to be applied to tasks that are
> conceptually  similar and, more important, to tasks that have not
> yet been conceived. 

-- 
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