Software /
code /
prosody
Changeset
11373:ad3b5384fc03
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 13 Feb 2021 13:38:56 +0100 |
parents | 11372:b877bd74d65e |
children | 11374:5b8aec0609f0 |
files | net/http/server.lua |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/net/http/server.lua Fri Feb 12 14:47:27 2021 +0100 +++ b/net/http/server.lua Sat Feb 13 13:38:56 2021 +0100 @@ -109,11 +109,20 @@ 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)