Skip to content

Commit

Permalink
Add test files
Browse files Browse the repository at this point in the history
  • Loading branch information
xyproto committed Oct 15, 2024
1 parent 46a74bc commit d0b9464
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions engine/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,15 @@ func (ac *Config) FilePage(w http.ResponseWriter, req *http.Request, filename, l
} else {
recorder.WriteHeader(http.StatusOK)
}
w.Header().Set("Connection", "Keep-Alive")
w.Header().Set("X-Content-Type-Options", "nosniff")
w.Header().Set("Content-Type", "text/html")
// Then write to the ResponseWriter
utils.WriteRecorder(w, recorder) // WriteRecorder starts out by writing the status header
if flusher, ok := w.(http.Flusher); ok {
flusher.Flush()
} else {
logrus.Error("NO FLUSHER")
}
}
// Run the lua script, without the possibility to flush
Expand Down Expand Up @@ -323,8 +328,13 @@ func (ac *Config) FilePage(w http.ResponseWriter, req *http.Request, filename, l
// The flush function just flushes the ResponseWriter
flushFunc := func() {
w.WriteHeader(http.StatusOK)
w.Header().Set("Connection", "Keep-Alive")
w.Header().Set("X-Content-Type-Options", "nosniff")
w.Header().Set("Content-Type", "text/html")
if flusher, ok := w.(http.Flusher); ok {
flusher.Flush()
} else {
logrus.Error("NO FLUSHER")
}
}
// Run the lua script, with the flush feature
Expand Down
5 changes: 5 additions & 0 deletions samples/www/index.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
print("hi")
flush()
--close()
sleep(5)
print("done")

0 comments on commit d0b9464

Please sign in to comment.