comparison mod_http_upload/mod_http_upload.lua @ 2651:2b741e68433b

mod_http_upload: Use correct function for base64
author Kim Alvefur <zash@zash.se>
date Tue, 28 Mar 2017 17:09:39 +0200
parents fef067b57305
children cfb7936ff61f
comparison
equal deleted inserted replaced
2650:fef067b57305 2651:2b741e68433b
17 local t_insert = table.insert; 17 local t_insert = table.insert;
18 local s_upper = string.upper; 18 local s_upper = string.upper;
19 local have_random, random = pcall(require, "util.random"); -- Only available in 0.10+ 19 local have_random, random = pcall(require, "util.random"); -- Only available in 0.10+
20 local uuid = require"util.uuid".generate; 20 local uuid = require"util.uuid".generate;
21 if have_random then 21 if have_random then
22 local b64 = require "util.encodings".base64; 22 local b64 = require "util.encodings".base64.encode;
23 local b64url = { ['+'] = '-', ['/'] = '_', ['='] = '' }; 23 local b64url = { ['+'] = '-', ['/'] = '_', ['='] = '' };
24 function uuid() 24 function uuid()
25 return (b64(random.bytes(8)):gsub("[+/=]", b64url)); 25 return (b64(random.bytes(8)):gsub("[+/=]", b64url));
26 end 26 end
27 end 27 end