diff options
Diffstat (limited to 'http.tcl')
-rwxr-xr-x | http.tcl | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -103,13 +103,15 @@ namespace eval http { # Sends an opened file or cached file. proc send-file {channel filename} { - #TODO: configure it to try the cache. - #TODO: configure channels to use binary translation if content type is not text/* - set file [open $filename] - fconfigure $file -translation binary fconfigure $channel -translation binary - fcopy $file $channel - close $file + if [cache::hit $filename] { + puts $channel [cache::get $filename] + } else { + set file [open $filename] + fconfigure $file -translation binary + fcopy $file $channel + close $file + } } ## Header |