[ee122] Directories with extensions

Daniel Killebrew dank at berkeley.edu
Wed Oct 31 15:18:34 PDT 2007



Calvin A wrote:
>> On Wed, Oct 31, 2007 at 12:20:27AM -0700, Carrell Killebrew wrote:
>>     
>>> Yes, list the directory's contents if the URL passed to you does
>>> refer to a directory, regardless of what the name 'looks like'.
>>>
>>> Don't bother looking at the file's contents, just blindly return
>>> text/plain since the extension is .txt
>>>       
>> Here's another case:
>>
>> Assume /index.html is a directory.
>>
>> When the client asks for /, do we:
>>   a) ls index.html
>>   b) recurse, so look for /index.html/index.html, and ls /index.html if
>>      index.html/index.html doesn't exist
>>   c) not worry about it because it's a really obnoxious corner case that
>>      doubles the length of the logic and you're a nice guy who isn't
>>      going to write any such test cases
>>
>>     
> And another:
>
> If we have
>
>  GET /foo.avi
>
> I thought we would just return "501 Not Implemented". Are we to check if
> it exists as a directory first? 
Correct, don't assume a URI refers to a file just because it has a 
recognized extension. You need to use ls to figure out if it's really a 
file or directory.
So if /foo.avi is a directory, then you will try to append /index.html 
to the URI, etc.
> If so, does that mean we need to append
> /index.html and check if that exists, then treat it as a directory and
> list the contents (if permitted)?
>
> In the case when we have
>
>  GET /foo.avi/
>
> it seems more clear that we check if the folder exists, then look for
> index.html, then list the directory's contents (if I'm not mistaken).
>   
The steps you suggest are correct.

Daniel
> Thanks,
> Calvin
>   
>> --
>> Chris Cowart
>> _______________________________________________
>> ee122 mailing list
>> ee122 at mailman.ICSI.Berkeley.EDU
>> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122
>>
>>     
>
>
> _______________________________________________
> ee122 mailing list
> ee122 at mailman.ICSI.Berkeley.EDU
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122
>
>   


More information about the ee122 mailing list