Posted to tcl by hypnotoad at Tue Oct 08 21:54:22 GMT 2019view pretty
method DoOutput {} { my variable reply_body chan if {$chan eq {}} return catch { # Causing random issues. Technically a socket is always open for read and write # anyway #my wait writable $chan chan configure $chan -encoding utf-8 -translation {auto crlf} ### # Return dynamic content ### set length [string length $reply_body] if {${length} > 0} { # Causing issues with Safari. When transmitting UTF-8 encoded data there seems # to be a disagreement about the actual length, and text files are being truncated my reply set Content-Length $length chan puts $chan [my reply output] chan configure $chan -encoding utf-8 -translation binary chan puts $chan [encoding convertto utf-8 $reply_body] } else { chan puts $chan [my reply output] } catch {chan flush $chan} my log HttpAccess {} } }