Tcl Library Source Code

View Ticket
Login
Ticket UUID: c0e70192dd45ea7b26cc8470a4025fe9e8b70d16
Title: httpd ::httpd::content.file method content issue
Type: Bug Version: 4.3.5
Submitter: anonymous Created on: 2023-11-10 16:21:40
Subsystem: httpd Assigned To: hypnotoad
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2024-01-09 12:21:05
Resolution: None Closed By: nobody
    Closed on:
Description:
I try to create a server to serve static files for myself.
If the URL is 
http://localhost:8015/Language/index.html

Then httpd will try to find
http://localhost:8015/Language/index.html/

Then results in "Listing contents of /Language/index.html/"
---> The behavior is wrong, because I request to get index.html file content.

After check the source code, I think because below conditions:

    if {[file isdirectory $local_file] || [file tail $local_file] in {index index.html index.tml index.md}} {
    
    
The condition [file tail $local_file] in {index index.html index.tml index.md} results in error case.
Is this condition correct? Or am I missing what things?
User Comments: hypnotoad (claiming to be Sean Woods) added on 2024-01-09 12:21:05:
I see now. We need to do a check to see if index.html is an actual file or not.

For the moment modify the line above to:

    if {[file isdirectory $local_file] || !([file exists $local_file] && [file tail $local_file] in {index index.html index.tml index.md})} {

I'll get a patch into the official sources soon.

aku added on 2024-01-08 15:32:03:
Sean, IIRC httpd is your package. Can you take a look ?