[tahoe-dev] help: how should you tell a web browser what name to use for a file?

zooko zooko at zooko.com
Fri May 9 11:51:51 PDT 2008


Folks:


We have a long-running and tricky design issue:

http://allmydata.org/trac/tahoe/ticket/221# (give proper filenames on  
download)

and I hope that some of you have a useful insight or at least a  
strong preference.


Here is the summary:

Currently in Tahoe there are two ways you can specify a file, either  
with its capability, e.g.:

http://tahoebs1.allmydata.com:8123/uri/URI%3ACHK% 
3Awaqatup4yk7dyoosuyaux6vwzu% 
3Alzoa4c2phsp3x7ws47bofsbihjm5avxqo35qrqscgqvtwrjotyra%3A3%3A10%3A313227

Or as the named child of a directory which is specified by its  
capability, e.g.:

http://tahoebs1.allmydata.com:8123/uri/URI%3ADIR2% 
3Azp3htohtvqpfjpcjzbt26g7lty% 
3Avd7tcfgpyboqjrl73yld2pcj5yepi3fn3ulhbcqfkyfnzkcugj4q/wiki.html

(Those two URLs denote the same file.)

Now, the problem is that in the first case, the web browser will  
think that the file's name is "URI%3ACHK%3Awaqatup4yk7dyoosuyaux6vwzu% 
3Alzoa4c2phsp3x7ws47bofsbihjm5avxqo35qrqscgqvtwrjotyra%3A3%3A10% 
3A313227" if you try to "save as" or to download it.  We would like a  
way to specify that we want to web browser to think of its name as  
"zookostiddlerdemo.html" even though that name is not used when  
looking it up in the Tahoe filesystem.

(Note that we're happy with what happens in the second case -- the  
web browser uses the rightmost name from the chain of names that was  
used to look it up in the Tahoe filesystem, e.g. if you use the URL:

http://tahoebs1.allmydata.com:8123/uri/URI%3ADIR2% 
3Azp3htohtvqpfjpcjzbt26g7lty% 
3Avd7tcfgpyboqjrl73yld2pcj5yepi3fn3ulhbcqfkyfnzkcugj4q/subdir1/ 
subdir2/wiki.html

Then the web browser will guess that "wiki.html" is a good name for  
it, which is what we want.)


Now the first question is: do we want it to be possible or impossible  
to specify a different "web browser's name for it" than the "name of  
child within immediate parent directory", in the case that there is a  
parent directory at all?

My intuition, when the question is posed that way, is "No -- let's  
have Only One Way To Do It, and that way will be that the web browser  
uses the name of the child from the parent directory.".

However, if we go that route, then we need a special case for URLs  
that refer to a file by the cap of the file, instead of by the child- 
name of the file in context of the cap of its parent dir.  Such URLs  
could, for example, have a different top-level name instead of /uri/,  
like this

http://tahoebs1.allmydata.com:8123/named/URI%3ACHK% 
3Awaqatup4yk7dyoosuyaux6vwzu% 
3Alzoa4c2phsp3x7ws47bofsbihjm5avxqo35qrqscgqvtwrjotyra%3A3%3A10% 
3A313227/zookostiddlerdemo.html

I don't like this.  It feels wrong.  (For reference, this is option  
1.b in ticket #221.)  It looks to me like this URL is denoting the  
child of something in the Tahoe filesystem which is called  
"zookostiddlerdemo.html" by its parent, but it is actually doing  
something quite different.

We could use two slashes instead of one to make them visually  
different from "name of child within its parent" URLs:

http://tahoebs1.allmydata.com:8123/named/URI%3ACHK% 
3Awaqatup4yk7dyoosuyaux6vwzu% 
3Alzoa4c2phsp3x7ws47bofsbihjm5avxqo35qrqscgqvtwrjotyra%3A3%3A10% 
3A313227//zookostiddlerdemo.html

This would be "option 1.d" in ticket #221 -- you aren't allowed to  
use "what the web browser should call it" names at all if the  
capability denotes a directory, only if the capability denotes a  
file, but when you do, you have to use *both* a different top-level  
part ("/named/") *and* two slashes.


The next question is, if we are allowed to express a special "what  
the web browser should call it" name by appending it to the URL of a  
capability-to-a-file, then why not generalize and allow the same  
syntax to have the same meaning for any URL?  This feels cleaner to  
me from this perspective, but now we've circled back around to  
allowing two different ways to communicate to the web browser about  
what it should call the file: either letting it use the rightmost  
name from the Tahoe filesystem's path, or else overriding that with a  
"//zookostiddlerdemo.html" name.


I'm not very happy with any of these options, and it sort of seems  
like neither is Brian.  Please let us know if you have any ideas.


Regards,

Zooko



More information about the tahoe-dev mailing list