Mercurial > prosody-hg
comparison plugins/mod_http_file_share.lua @ 11334:dbba2d44fda2
mod_http_file_share: Allow started uploads to complete after token expired
Otherwise uploads taking longer than 5 minutes would be rejected on
completion, and that's probably annoying.
Thanks jonas’
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 28 Jan 2021 17:24:37 +0100 |
| parents | f80056b97cf0 |
| children | b7acab5e7f57 |
comparison
equal
deleted
inserted
replaced
| 11333:f80056b97cf0 | 11334:dbba2d44fda2 |
|---|---|
| 167 local authed, upload_info = jwt.verify(secret, authz); | 167 local authed, upload_info = jwt.verify(secret, authz); |
| 168 if not (authed and type(upload_info) == "table" and type(upload_info.exp) == "number") then | 168 if not (authed and type(upload_info) == "table" and type(upload_info.exp) == "number") then |
| 169 module:log("debug", "Unauthorized or invalid token: %s, %q", authed, upload_info); | 169 module:log("debug", "Unauthorized or invalid token: %s, %q", authed, upload_info); |
| 170 return 401; | 170 return 401; |
| 171 end | 171 end |
| 172 if upload_info.exp < os.time() then | 172 if not request.body_sink and upload_info.exp < os.time() then |
| 173 module:log("debug", "Authorization token expired on %s", dt.datetime(upload_info.exp)); | 173 module:log("debug", "Authorization token expired on %s", dt.datetime(upload_info.exp)); |
| 174 return 410; | 174 return 410; |
| 175 end | 175 end |
| 176 if not path or upload_info.slot ~= path:match("^[^/]+") then | 176 if not path or upload_info.slot ~= path:match("^[^/]+") then |
| 177 module:log("debug", "Invalid upload slot: %q, path: %q", upload_info.slot, path); | 177 module:log("debug", "Invalid upload slot: %q, path: %q", upload_info.slot, path); |
