27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
if {![file exists $file]} {
set tmpfile "${file}.new"
set fd [open $tmpfile "w"]
fconfigure $fd -translation binary
set token [::http::geturl $url -channel $fd -binary true]
set ncode [::http::ncode $token]
::http::reset $token
close $fd
if {$keyIsHash} {
catch {
set hash [string tolower [exec openssl sha1 $tmpfile]]
regsub {.*= *} $hash {} hash
}
|
>
|
>
>
>
|
|
>
>
>
>
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
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} {
catch {
set hash [string tolower [exec openssl sha1 $tmpfile]]
regsub {.*= *} $hash {} hash
}
|