Check-in [6bae3dde7d]
Overview
Comment:Updated to rely upon "sha1" package to compute hashes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:6bae3dde7dbd1b79d502deb6a4c3eba6b068aec2
User & Date: rkeene on 2014-11-03 22:31:54
Other Links: manifest | tags
Context
2014-11-03
22:59
Updated to complain if hash cannot be computed check-in: 0cefa306d2 user: rkeene tags: trunk
22:31
Updated to rely upon "sha1" package to compute hashes check-in: 6bae3dde7d user: rkeene tags: trunk
19:07
Updated to not crash upon Tcl initialization failure check-in: 85c5ea8446 user: rkeene tags: trunk
Changes

Modified appfsd.tcl from [2fbc0cdff7] to [6a56c0db7f].

     1      1   #! /usr/bin/env tclsh
     2      2   
     3      3   package require http 2.7
     4      4   package require sqlite3
            5  +package require sha1
     5      6   
     6      7   namespace eval ::appfs {
     7      8   	variable cachedir "/tmp/appfs-cache"
     8      9   	variable ttl 3600
     9     10   	variable nttl 60
    10     11   
    11     12   	proc _hash_sep {hash {seps 4}} {
................................................................................
    43     44   			} else {
    44     45   				set ncode "900"
    45     46   			}
    46     47   
    47     48   			close $fd
    48     49   
    49     50   			if {$keyIsHash} {
           51  +				set hash "__UNABLE_TO_COMPUTE_HASH__"
    50     52   				catch {
    51         -					set hash [string tolower [exec openssl sha1 $tmpfile]]
    52         -					regsub {.*= *} $hash {} hash
           53  +					set hash [string tolower [sha1::sha1 -hex -file $tmpfile]]
    53     54   				}
    54     55   			} else {
    55     56   				set hash $key
    56     57   			}
    57     58   
    58     59   			if {$ncode == "200" && $hash == $key} {
    59     60   				file rename -force -- $tmpfile $file