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
2
3
4

5
6
7
8
9
10
11
#! /usr/bin/env tclsh

package require http 2.7
package require sqlite3


namespace eval ::appfs {
	variable cachedir "/tmp/appfs-cache"
	variable ttl 3600
	variable nttl 60

	proc _hash_sep {hash {seps 4}} {




>







1
2
3
4
5
6
7
8
9
10
11
12
#! /usr/bin/env tclsh

package require http 2.7
package require sqlite3
package require sha1

namespace eval ::appfs {
	variable cachedir "/tmp/appfs-cache"
	variable ttl 3600
	variable nttl 60

	proc _hash_sep {hash {seps 4}} {
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
59
			} else {
				set ncode "900"
			}

			close $fd

			if {$keyIsHash} {

				catch {
					set hash [string tolower [exec openssl sha1 $tmpfile]]
					regsub {.*= *} $hash {} hash
				}
			} else {
				set hash $key
			}

			if {$ncode == "200" && $hash == $key} {
				file rename -force -- $tmpfile $file







>

|
<







44
45
46
47
48
49
50
51
52
53

54
55
56
57
58
59
60
			} else {
				set ncode "900"
			}

			close $fd

			if {$keyIsHash} {
				set hash "__UNABLE_TO_COMPUTE_HASH__"
				catch {
					set hash [string tolower [sha1::sha1 -hex -file $tmpfile]]

				}
			} else {
				set hash $key
			}

			if {$ncode == "200" && $hash == $key} {
				file rename -force -- $tmpfile $file