Skip to content

Commit

Permalink
windows always use asynchttpserver
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout committed Aug 13, 2021
1 parent 98a56bc commit 7eaadce
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FAQ

(1). `Prologue` supports two HTTP server: `httpbeast` and `asynchttpserver`. If you are in Linux or MacOS, use `--threads:on` to enable the multi-threads HTTP server. If you are in windows, `threads` should not be used. You can use `-d:usestd` to switch to `asynchttpserver`.
(1). `Prologue` supports two HTTP server: `httpbeast` and `asynchttpserver`. If you are in Linux or MacOS, use `--threads:on` to enable the multi-threads HTTP server. If you are in windows, `threads` should not be used. You can use `-d:usestd` to switch to `asynchttpserver` in Linux or MacOS.

(2). If you want to benchmark `prologue` or release you programs, make sure set `settings.debug` = false.

Expand Down
4 changes: 2 additions & 2 deletions src/prologue/core/constants.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const
PrologueVersion* = "0.4.2" ## The current version of Prologue.
PrologueVersion* = "0.4.8" ## The current version of Prologue.
ProloguePrefix* = "PROLOGUE" ## The helper prefix for environment variables.
useAsyncHTTPServer* = defined(usestd) ## Uses `asynchttpserver`.
useAsyncHTTPServer* = defined(windows) or defined(usestd) ## Uses `asynchttpserver`.
15 changes: 1 addition & 14 deletions src/prologue/core/context.nim
Original file line number Diff line number Diff line change
Expand Up @@ -500,20 +500,7 @@ proc staticFileResponse*(
"If-None-Match"] == etag:
await ctx.respond(Http304, "")
elif contentLength < 10_000_000:
## TODO
when defined(windows) and not defined(usestd):
proc readAllData(f: AsyncFile): Future[string] {.async.} =
## Reads all data from the specified file.
result = ""
while true:
let data = await read(f, 40000)
if data.len == 0:
return
result.add data

ctx.response.body = await file.readAllData()
else:
ctx.response.body = await file.readAll()
ctx.response.body = await file.readAll()
await ctx.respond()
else:
ctx.response.setHeader("Content-Length", $contentLength)
Expand Down

0 comments on commit 7eaadce

Please sign in to comment.