bsw@401: if not config.document_dir then bsw@401: error("feature not enabled") bsw@401: end bsw@401: bsw@401: local filename = param.get("filename") bsw@401: bsw@401: local file = assert(io.open(encode.file_path(config.document_dir, filename)), "file not found") bsw@401: bsw@401: print('Content-type: application/octet-stream') bsw@401: print('Content-disposition: attachment; filename=' .. filename) bsw@401: print('') bsw@401: bsw@401: io.stdout:write(file:read("*a")) bsw@401: bsw@401: exit()