comparison mod_ogp/mod_ogp.lua @ 4504:0136c98f574c

mod_ogp: Log error responses
author JC Brand <jc@opkode.com>
date Mon, 08 Mar 2021 13:25:40 +0100
parents c4f11a4b5ac7
children 09f0911c735d
comparison
equal deleted inserted replaced
4503:80912726405d 4504:0136c98f574c
28 http.request( 28 http.request(
29 url, 29 url,
30 nil, 30 nil,
31 function(response_body, response_code, _) 31 function(response_body, response_code, _)
32 if response_code ~= 200 then 32 if response_code ~= 200 then
33 module:log("debug", "Call to %s returned code %s and body %s", url, response_code, response_body)
33 return 34 return
34 end 35 end
35 36
36 local to = room.jid 37 local to = room.jid
37 local from = room and room.jid or module.host 38 local from = room and room.jid or module.host
56 if not content then 57 if not content then
57 content = match:match([[content=(.-)$]]) 58 content = match:match([[content=(.-)$]])
58 end 59 end
59 60
60 if property and content then 61 if property and content then
61 module:log("info", property .. "\t" .. content) 62 module:log("debug", property .. "\t" .. content)
62 fastening:tag( 63 fastening:tag(
63 "meta", 64 "meta",
64 { 65 {
65 xmlns = xmlns_xhtml, 66 xmlns = xmlns_xhtml,
66 property = property, 67 property = property,
73 end 74 end
74 75
75 if found_metadata then 76 if found_metadata then
76 mod_muc.get_room_from_jid(room.jid):broadcast_message(fastening) 77 mod_muc.get_room_from_jid(room.jid):broadcast_message(fastening)
77 end 78 end
78 module:log("info", tostring(fastening)) 79 module:log("debug", tostring(fastening))
79 end 80 end
80 ) 81 )
81 end 82 end
82 83
83 local function ogp_handler(event) 84 local function ogp_handler(event)