Subject: RFC 2396 and SMB URLs

From: "Michael B. Allen" <[email-masked]>
Date: Mon, 7 Oct 2002 15:07:14 -0400

I've  been working with a guy doing an SMB URL IETF draft because my client
uses  it.  SMB is MS's file and printer sharing protocol (e.g. net use, Map
network  drive ...). I have a problem and I was hoping your experience with
HTTP URLs might help us. 

We  want  to use a URL like 'smb://' to denote the top of the network which
would  be  used  exclusively to list workgroups. Listing 'smb://WORKGROUP/'
will  list  all servers that are members of that workgroup. Other than that
these SMB URLs are like most others:

  smb://miallen@server/share/path/to/file.doc

My  problem  is that my Java client uses the standard java.net.URL class to
parse  URLs  which parses everything ok except for these top level 'smb://'
URLs  and URLs composed from 'smb://' as a context URL and a relative path.
For example: 

  smb://                --> smb:
  smb:// + WORKGROUP/   --> smb:/WORKGROUP/
  smb:// + //WORKGROUP/ --> smb://WORKGROUP/
  smb:////              --> smb://

You  can  see that this breaks our 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 'WORKGROUP/' is substituted
with '//WORKGROUP/' 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 agree with RFC 2396? I find it hard to
believe  Sun got it wrong. If java.net.URL is right then what should proper
semantics be for a URL like this? 

Any help would be greatly appreciated,
Mike

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