Diff

Differences From Artifact [d941737404]:

To Artifact [7c607fdb04]:


30
31
32
33
34
35
36
37



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
			set filekey [_hash_sep $filekey]
		}

		set file [file join $::appfs::cachedir $filekey]

		file mkdir [file dirname $file]

		if {![file exists $file]} {



			set tmpfile "${file}.new"

			set fd [open $tmpfile "w"]
			fconfigure $fd -translation binary

			catch {
				set token [::http::geturl $url -channel $fd -binary true]
			}

			if {[info exists token]} {
				set ncode [::http::ncode $token]
				::http::reset $token
			} else {
				set ncode "900"
			}

			close $fd

			if {$keyIsHash} {
				set hash [string tolower [sha1::sha1 -hex -file $tmpfile]]
			} else {
				set hash $key
			}

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

		return $file
	}


	proc _isHash {value} {







|
>
>
>
|

|
|

|
|
|

|
|
|
|
|
|

|

|
|
|
|
|

|
|
|
|
<







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

69
70
71
72
73
74
75
			set filekey [_hash_sep $filekey]
		}

		set file [file join $::appfs::cachedir $filekey]

		file mkdir [file dirname $file]

		if {[file exists $file]} {
			return $file
		}

		set tmpfile "${file}.[expr {rand()}]"

		set fd [open $tmpfile "w"]
		fconfigure $fd -translation binary

		catch {
			set token [::http::geturl $url -channel $fd -binary true]
		}

		if {[info exists token]} {
			set ncode [::http::ncode $token]
			::http::reset $token
		} else {
			set ncode "900"
		}

		close $fd

		if {$keyIsHash} {
			set hash [string tolower [sha1::sha1 -hex -file $tmpfile]]
		} else {
			set hash $key
		}

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

		}

		return $file
	}


	proc _isHash {value} {