3 set Host paster.example.com
7 set fn [lindex $argv 0]
9 if {($argc > 0) && [file exists $fn]} {
10 set ext [file extension $fn]
11 set fd [open $fn {RDONLY BINARY}]
12 set size [file size $fn]
14 chan configure stdin -encoding binary -translation binary
16 set size [string length $data]
17 if {$argc > 0} {set ext $fn}
21 set sock [open "|gnutls-cli --logfile=/dev/null -p $Port $Host" {RDWR BINARY}]
23 set sock [socket $Host $Port]
24 chan configure $sock -encoding binary -translation binary
26 puts -nonewline $sock "d"
27 if {[info exists ext]} {
28 set ext [string trimleft $ext .]
29 puts -nonewline $sock [string cat "1:e" [string length $ext] ":$ext"]
31 puts -nonewline $sock "1:v$size:"
32 if {[info exists fd]} {
36 puts -nonewline $sock $data
38 puts -nonewline $sock "e"
40 while {[gets $sock line] >= 0} { puts $line }