Comparison

net/http/files.lua @ 10327:34f7a0e8fa59

net.http.files: Explicitly convert number to string, avoiding implicit coercion
author Kim Alvefur <zash@zash.se>
date Sat, 12 Oct 2019 19:31:48 +0200
parent 10065:b399dca1273c
child 10411:db2a06b9ff98
comparison
equal deleted inserted replaced
10326:cd1c73c2bdec 10327:34f7a0e8fa59
125 end 125 end
126 local ext = full_path:match("%.([^./]+)$"); 126 local ext = full_path:match("%.([^./]+)$");
127 local content_type = ext and mime_map[ext]; 127 local content_type = ext and mime_map[ext];
128 response_headers.content_type = content_type; 128 response_headers.content_type = content_type;
129 if attr.size > cache_max_file_size then 129 if attr.size > cache_max_file_size then
130 response_headers.content_length = attr.size; 130 response_headers.content_length = ("%d"):format(attr.size);
131 log("debug", "%d > cache_max_file_size", attr.size); 131 log("debug", "%d > cache_max_file_size", attr.size);
132 return response:send_file(f); 132 return response:send_file(f);
133 else 133 else
134 data = f:read("*a"); 134 data = f:read("*a");
135 f:close(); 135 f:close();