[jcifs] Re: SMB URL encoding/decoding
teilo at teilo.net
Sun Feb 24 14:16:36 EST 2002
Michael B Allen wrote:
>On Sat, 23 Feb 2002 20:34:43 -0600
>"Christopher R. Hertel" <crh at ubiqx.org> wrote:
>>I think you are both right to some extent here. Generally speaking an '@'
>>char is in the <reserved> set and should typically by escaped. However...
>> net_path = "//" authority [ abs_path ]
>> abs_path = "/" path_segments
>> rel_path = rel_segment [ abs_path ]
>> path = [ abs_path | opaque_part ]
>> path_segments = segment *( "/" segment )
>> segment = *pchar *( ";" param )
>> param = *pchar
>> pchar = unreserved | escaped |
>> ":" | "@" | "&" | "=" | "+" | "$" | ","
>>According to all that mess, the "@" is a legal pchar, and path strings are
>>made up of pchars. So... Yes, the "@" may be used unescaped in a path.
>Ok, well then we're doing this all wrong. I want to know how the author
>of this grammer defines "authority" and how to traverse all the characters
>that might apear in the the password.
Take everything between the first two // and the next / (or end of
string if no slash) everything else is <path field>
then if there is an @ (there can only be 0 or 1) then
everything before is a <userauth>
everything after is <server field>
Take the <userauth>
if there is a : (there can only be 0 or 1)
then everything before is <userinfo field> everything after is
take the <userinfo field>
if there is a ; (there can be only 0 or 1)
then everything before the ; is <domain field>
everything after is <username field>
NT Domain = urldecode ( <domain field>)
username = urldecode (<username field>)
password = urldecode(<password field>)
server = urldecode(<server field>)
path = urldecode<path field>
and to go the other way urlencode...
More information about the jcifs