summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Haip <jhaip@users.noreply.github.com>2023-03-23 03:10:20 +0000
committerJacob Haip <jhaip@users.noreply.github.com>2023-03-23 03:10:20 +0000
commitab2659b28592bfdb4d03365ddcd39bf5c6f7ae2f (patch)
tree24e704ce507630f8eb1b1ffe2016b6b9ab3975a8
parentmove new-program-web-editor to virtual-programs (diff)
downloadfolk-ab2659b28592bfdb4d03365ddcd39bf5c6f7ae2f.tar.gz
folk-ab2659b28592bfdb4d03365ddcd39bf5c6f7ae2f.zip
fix handling of web response with contentType and body
-rw-r--r--web.tcl12
1 files changed, 6 insertions, 6 deletions
diff --git a/web.tcl b/web.tcl
index e3c7fb32..0a95f6b7 100644
--- a/web.tcl
+++ b/web.tcl
@@ -96,24 +96,24 @@ proc handleRead {chan addr port} {
if {$response ne "" && [dict exists $response raw]} {
puts -nonewline $chan [dict get $response raw]
} else {
- set response {}
+ set finalResponse {}
if {$html ne ""} {
- set response $html
+ set finalResponse $html
} elseif {$response ne ""} {
if {[dict exists $response contentType]} {
set contentType [dict get $response contentType]
}
if {[dict exists $response body]} {
- set response [dict get $response body]
+ set finalResponse [dict get $response body]
} else {
- set response "error missing body"
+ set finalResponse "error missing body"
}
} else {
- set response [handlePage $path contentType]
+ set finalResponse [handlePage $path contentType]
}
puts -nonewline $chan "HTTP/1.1 200 OK\nConnection: close\nContent-Type: $contentType\n\n"
chan configure $chan -encoding binary -translation binary
- puts -nonewline $chan $response
+ puts -nonewline $chan $finalResponse
}
close $chan
} elseif {[::websocket::test $::serverSock $chan "/ws" $headers]} {