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@402: if param.get("inline") then bsw@402: print('Content-disposition: inline; filename=' .. filename) bsw@402: else bsw@402: print('Content-disposition: attachment; filename=' .. filename) bsw@402: end bsw@401: print('') bsw@401: bsw@401: io.stdout:write(file:read("*a")) bsw@401: bsw@401: exit()