commit - ef30005ec7adf0836f62715267b50be8632fb877
commit + b28be21f0f8cb1d884d3831c67115e34ee16c793
blob - 60fa73fe95beff5dfd776fde9d75e9d8e74241a3
blob + 7faeb6ca6a4b1e410be10ebe39e6c64bd47f88df
--- http/http.ha
+++ http/http.ha
export fn write(clt: *client, body: str) (void | error) = {
if (!clt.hdrdone) {
- // XXX
- header(clt, "Transfer-Encoding", "chunked")?;
+ if (clt.chunked) {
+ header(clt, "Transfer-Encoding", "chunked")?;
+ };
header(clt, "Connection", "closed")?;
clt.hdrdone = true;
fmt::fprint(clt.fp, "\r\n")?;
};
- fmt::fprintf(clt.fp, "{:x}\r\n{}\r\n", len(body), body)?;
+ if (clt.chunked) {
+ fmt::fprintf(clt.fp, "{:x}\r\n{}\r\n", len(body), body)?;
+ } else {
+ fmt::fprintf(clt.fp, "{}", body)?;
+ };
};
fn route_notfound(clt: *client) (void | error) = {