comparison mod_http_muc_log/mod_http_muc_log.lua @ 1579:9e784ddac236

mod_http_muc_log: Include charset in Content-Type header
author Kim Alvefur <zash@zash.se>
date Tue, 02 Dec 2014 14:14:38 +0100
parents a68ec7a2dc02
children 63571115302f
comparison
equal deleted inserted replaced
1578:a68ec7a2dc02 1579:9e784ddac236
235 next_day = datetime.parse(next_day .. "T23:59:59Z") + 1; 235 next_day = datetime.parse(next_day .. "T23:59:59Z") + 1;
236 break; 236 break;
237 end 237 end
238 until not next_day; 238 until not next_day;
239 239
240 response.headers.content_type = "text/html"; 240 response.headers.content_type = "text/html; charset=utf-8";
241 return dates_template{ 241 return dates_template{
242 host = module.host; 242 host = module.host;
243 canonical = module:http_url() .. "/" .. path; 243 canonical = module:http_url() .. "/" .. path;
244 room = room; 244 room = room;
245 lines = table.concat(dates); 245 lines = table.concat(dates);
314 }) do 314 }) do
315 prev_when = datetime.date(when); 315 prev_when = datetime.date(when);
316 module:log("debug", "Previous message: %s", datetime.datetime(when)); 316 module:log("debug", "Previous message: %s", datetime.datetime(when));
317 end 317 end
318 318
319 response.headers.content_type = "text/html"; 319 response.headers.content_type = "text/html; charset=utf-8";
320 return page_template{ 320 return page_template{
321 canonical = module:http_url() .. "/" .. path; 321 canonical = module:http_url() .. "/" .. path;
322 host = module.host; 322 host = module.host;
323 room = room; 323 room = room;
324 date = date; 324 date = date;
338 description = room:get_description(); 338 description = room:get_description();
339 }, i + 1; 339 }, i + 1;
340 end 340 end
341 end 341 end
342 342
343 event.response.headers.content_type = "text/html"; 343 event.response.headers.content_type = "text/html; charset=utf-8";
344 return room_list_template { 344 return room_list_template {
345 host = module.host; 345 host = module.host;
346 canonical = module:http_url() .. "/"; 346 canonical = module:http_url() .. "/";
347 rooms = table.concat(room_list); 347 rooms = table.concat(room_list);
348 }; 348 };
363 module:log("debug", "Client cache hit"); 363 module:log("debug", "Client cache hit");
364 return 304; 364 return 304;
365 end 365 end
366 module:log("debug", "Server cache hit"); 366 module:log("debug", "Server cache hit");
367 response.headers.etag = etag; 367 response.headers.etag = etag;
368 response.headers.content_type = "text/html"; 368 response.headers.content_type = "text/html; charset=utf-8";
369 return cached[1]; 369 return cached[1];
370 end 370 end
371 371
372 local start = gettime(); 372 local start = gettime();
373 local render = f(event, path); 373 local render = f(event, path);
378 cached = { render, etag = etag, date = datetime.date() }; 378 cached = { render, etag = etag, date = datetime.date() };
379 response.headers.etag = etag; 379 response.headers.etag = etag;
380 cache[ckey] = cached; 380 cache[ckey] = cached;
381 end 381 end
382 382
383 response.headers.content_type = "text/html"; 383 response.headers.content_type = "text/html; charset=utf-8";
384 return render; 384 return render;
385 end 385 end
386 end 386 end
387 387
388 -- How is cache invalidation a hard problem? ;) 388 -- How is cache invalidation a hard problem? ;)