diff options
author | Kim Alvefur <zash@zash.se> | 2021-02-13 13:38:56 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-02-13 13:38:56 +0100 |
commit | f0ac9196099c7384f2cef16b0890f974ea30b641 (patch) | |
tree | d90950ab854c1f53bd3e5fe2f19220a3adb95748 | |
parent | 3c96f613c0b14c3114e900fec3f9d6eae11e5e77 (diff) | |
download | prosody-f0ac9196099c7384f2cef16b0890f974ea30b641.tar.gz prosody-f0ac9196099c7384f2cef16b0890f974ea30b641.zip |
net.http.server: Don't pause early streaming uploads
Fixes that otherwise it would wait for the request to be done after
receiving the head of the request, when it's meant to select a target
for where to store the data, instead of waiting after receiving the
request for when the request has been handled.
-rw-r--r-- | net/http/server.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/net/http/server.lua b/net/http/server.lua index 7c79edee..df87283a 100644 --- a/net/http/server.lua +++ b/net/http/server.lua @@ -109,11 +109,20 @@ function runner_callbacks:error(err) self.data.conn:close(); end +local function noop() end function listener.onconnect(conn) local session = { conn = conn }; local secure = conn:ssl() and true or nil; session.thread = async.runner(function (request) - local wait, done = async.waiter(); + local wait, done; + if request.partial == true then + -- Have the header for a request, we want to receive the rest + -- when we've decided where the data should go. + wait, done = noop, noop; + else -- Got the entire request + -- Hold off on receiving more incoming requests until this one has been handled. + wait, done = async.waiter(); + end handle_request(conn, request, done); wait(); end, runner_callbacks, session); local function success_cb(request) |