您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

util.lib.lua 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. local http_server = require "net.http.server";
  2. local jid = require "util.jid";
  3. local st = require 'util.stanza';
  4. local timer = require "util.timer";
  5. local http = require "net.http";
  6. local cache = require "util.cache";
  7. local array = require "util.array";
  8. local is_set = require 'util.set'.is_set;
  9. local http_timeout = 30;
  10. local have_async, async = pcall(require, "util.async");
  11. local http_headers = {
  12. ["User-Agent"] = "Prosody ("..prosody.version.."; "..prosody.platform..")"
  13. };
  14. local muc_domain_prefix = module:get_option_string("muc_mapper_domain_prefix", "conference");
  15. -- defaults to module.host, the module that uses the utility
  16. local muc_domain_base = module:get_option_string("muc_mapper_domain_base", module.host);
  17. -- The "real" MUC domain that we are proxying to
  18. local muc_domain = module:get_option_string("muc_mapper_domain", muc_domain_prefix.."."..muc_domain_base);
  19. local escaped_muc_domain_base = muc_domain_base:gsub("%p", "%%%1");
  20. local escaped_muc_domain_prefix = muc_domain_prefix:gsub("%p", "%%%1");
  21. -- The pattern used to extract the target subdomain
  22. -- (e.g. extract 'foo' from 'conference.foo.example.com')
  23. local target_subdomain_pattern = "^"..escaped_muc_domain_prefix..".([^%.]+)%."..escaped_muc_domain_base;
  24. -- table to store all incoming iqs without roomname in it, like discoinfo to the muc component
  25. local roomless_iqs = {};
  26. local OUTBOUND_SIP_JIBRI_PREFIXES = { 'outbound-sip-jibri@', 'sipjibriouta@', 'sipjibrioutb@' };
  27. local INBOUND_SIP_JIBRI_PREFIXES = { 'inbound-sip-jibri@', 'sipjibriina@', 'sipjibriina@' };
  28. local RECORDER_PREFIXES = module:get_option_inherited_set('recorder_prefixes', { 'recorder@recorder.', 'jibria@recorder.', 'jibrib@recorder.' });
  29. local TRANSCRIBER_PREFIXES = module:get_option_inherited_set('transcriber_prefixes', { 'transcriber@recorder.', 'transcribera@recorder.', 'transcriberb@recorder.' });
  30. local split_subdomain_cache = cache.new(1000);
  31. local extract_subdomain_cache = cache.new(1000);
  32. local internal_room_jid_cache = cache.new(1000);
  33. local moderated_subdomains = module:get_option_set("allowners_moderated_subdomains", {})
  34. local moderated_rooms = module:get_option_set("allowners_moderated_rooms", {})
  35. -- Utility function to split room JID to include room name and subdomain
  36. -- (e.g. from room1@conference.foo.example.com/res returns (room1, example.com, res, foo))
  37. local function room_jid_split_subdomain(room_jid)
  38. local ret = split_subdomain_cache:get(room_jid);
  39. if ret then
  40. return ret.node, ret.host, ret.resource, ret.subdomain;
  41. end
  42. local node, host, resource = jid.split(room_jid);
  43. local target_subdomain = host and host:match(target_subdomain_pattern);
  44. local cache_value = {node=node, host=host, resource=resource, subdomain=target_subdomain};
  45. split_subdomain_cache:set(room_jid, cache_value);
  46. return node, host, resource, target_subdomain;
  47. end
  48. --- Utility function to check and convert a room JID from
  49. --- virtual room1@conference.foo.example.com to real [foo]room1@conference.example.com
  50. -- @param room_jid the room jid to match and rewrite if needed
  51. -- @param stanza the stanza
  52. -- @return returns room jid [foo]room1@conference.example.com when it has subdomain
  53. -- otherwise room1@conference.example.com(the room_jid value untouched)
  54. local function room_jid_match_rewrite(room_jid, stanza)
  55. local node, _, resource, target_subdomain = room_jid_split_subdomain(room_jid);
  56. if not target_subdomain then
  57. -- module:log("debug", "No need to rewrite out 'to' %s", room_jid);
  58. return room_jid;
  59. end
  60. -- Ok, rewrite room_jid address to new format
  61. local new_node, new_host, new_resource;
  62. if node then
  63. new_node, new_host, new_resource = "["..target_subdomain.."]"..node, muc_domain, resource;
  64. else
  65. -- module:log("debug", "No room name provided so rewriting only host 'to' %s", room_jid);
  66. new_host, new_resource = muc_domain, resource;
  67. if (stanza and stanza.attr and stanza.attr.id) then
  68. roomless_iqs[stanza.attr.id] = stanza.attr.to;
  69. end
  70. end
  71. return jid.join(new_node, new_host, new_resource);
  72. end
  73. -- Utility function to check and convert a room JID from real [foo]room1@muc.example.com to virtual room1@muc.foo.example.com
  74. local function internal_room_jid_match_rewrite(room_jid, stanza)
  75. -- first check for roomless_iqs
  76. if (stanza and stanza.attr and stanza.attr.id and roomless_iqs[stanza.attr.id]) then
  77. local result = roomless_iqs[stanza.attr.id];
  78. roomless_iqs[stanza.attr.id] = nil;
  79. return result;
  80. end
  81. local ret = internal_room_jid_cache:get(room_jid);
  82. if ret then
  83. return ret;
  84. end
  85. local node, host, resource = jid.split(room_jid);
  86. if host ~= muc_domain or not node then
  87. -- module:log("debug", "No need to rewrite %s (not from the MUC host)", room_jid);
  88. internal_room_jid_cache:set(room_jid, room_jid);
  89. return room_jid;
  90. end
  91. local target_subdomain, target_node = extract_subdomain(node);
  92. if not (target_node and target_subdomain) then
  93. -- module:log("debug", "Not rewriting... unexpected node format: %s", node);
  94. internal_room_jid_cache:set(room_jid, room_jid);
  95. return room_jid;
  96. end
  97. -- Ok, rewrite room_jid address to pretty format
  98. ret = jid.join(target_node, muc_domain_prefix..".".. target_subdomain.."."..muc_domain_base, resource);
  99. internal_room_jid_cache:set(room_jid, ret);
  100. return ret;
  101. end
  102. --- Finds and returns room by its jid
  103. -- @param room_jid the room jid to search in the muc component
  104. -- @return returns room if found or nil
  105. function get_room_from_jid(room_jid)
  106. local _, host = jid.split(room_jid);
  107. local component = hosts[host];
  108. if component then
  109. local muc = component.modules.muc
  110. if muc and rawget(muc,"rooms") then
  111. -- We're running 0.9.x or 0.10 (old MUC API)
  112. return muc.rooms[room_jid];
  113. elseif muc and rawget(muc,"get_room_from_jid") then
  114. -- We're running >0.10 (new MUC API)
  115. return muc.get_room_from_jid(room_jid);
  116. else
  117. return
  118. end
  119. end
  120. end
  121. -- Returns the room if available, work and in multidomain mode
  122. -- @param room_name the name of the room
  123. -- @param group name of the group (optional)
  124. -- @return returns room if found or nil
  125. function get_room_by_name_and_subdomain(room_name, subdomain)
  126. local room_address;
  127. -- if there is a subdomain we are in multidomain mode and that subdomain is not our main host
  128. if subdomain and subdomain ~= "" and subdomain ~= muc_domain_base then
  129. room_address = jid.join("["..subdomain.."]"..room_name, muc_domain);
  130. else
  131. room_address = jid.join(room_name, muc_domain);
  132. end
  133. return get_room_from_jid(room_address);
  134. end
  135. function async_handler_wrapper(event, handler)
  136. if not have_async then
  137. module:log("error", "requires a version of Prosody with util.async");
  138. return nil;
  139. end
  140. local runner = async.runner;
  141. -- Grab a local response so that we can send the http response when
  142. -- the handler is done.
  143. local response = event.response;
  144. local async_func = runner(
  145. function (event)
  146. local result = handler(event)
  147. -- If there is a status code in the result from the
  148. -- wrapped handler then add it to the response.
  149. if tonumber(result.status_code) ~= nil then
  150. response.status_code = result.status_code
  151. end
  152. -- If there are headers in the result from the
  153. -- wrapped handler then add them to the response.
  154. if result.headers ~= nil then
  155. response.headers = result.headers
  156. end
  157. -- Send the response to the waiting http client with
  158. -- or without the body from the wrapped handler.
  159. if result.body ~= nil then
  160. response:send(result.body)
  161. else
  162. response:send();
  163. end
  164. end
  165. )
  166. async_func:run(event)
  167. -- return true to keep the client http connection open.
  168. return true;
  169. end
  170. --- Updates presence stanza, by adding identity node
  171. -- @param stanza the presence stanza
  172. -- @param user the user to which presence we are updating identity
  173. -- @param group the group of the user to which presence we are updating identity
  174. -- @param creator_user the user who created the user which presence we
  175. -- are updating (this is the poltergeist case, where a user creates
  176. -- a poltergeist), optional.
  177. -- @param creator_group the group of the user who created the user which
  178. -- presence we are updating (this is the poltergeist case, where a user creates
  179. -- a poltergeist), optional.
  180. function update_presence_identity(stanza, user, group, creator_user, creator_group)
  181. -- First remove any 'identity' element if it already
  182. -- exists, so it cannot be spoofed by a client
  183. stanza:maptags(
  184. function(tag)
  185. for k, v in pairs(tag) do
  186. if k == "name" and v == "identity" then
  187. return nil
  188. end
  189. end
  190. return tag
  191. end
  192. );
  193. if not user then
  194. return;
  195. end
  196. stanza:tag("identity"):tag("user");
  197. for k, v in pairs(user) do
  198. v = tostring(v)
  199. stanza:tag(k):text(v):up();
  200. end
  201. stanza:up();
  202. -- Add the group information if it is present
  203. if group then
  204. stanza:tag("group"):text(group):up();
  205. end
  206. -- Add the creator user information if it is present
  207. if creator_user then
  208. stanza:tag("creator_user");
  209. for k, v in pairs(creator_user) do
  210. stanza:tag(k):text(v):up();
  211. end
  212. stanza:up();
  213. -- Add the creator group information if it is present
  214. if creator_group then
  215. stanza:tag("creator_group"):text(creator_group):up();
  216. end
  217. end
  218. stanza:up(); -- Close identity tag
  219. end
  220. -- Utility function to check whether feature is present and enabled. Allow
  221. -- a feature if there are features present in the session(coming from
  222. -- the token) and the value of the feature is true.
  223. -- If features are missing but we have granted_features check that
  224. -- if features are missing from the token we check whether it is moderator
  225. function is_feature_allowed(ft, features, granted_features, is_moderator)
  226. if features then
  227. return features[ft] == "true" or features[ft] == true;
  228. elseif granted_features then
  229. return granted_features[ft] == "true" or granted_features[ft] == true;
  230. else
  231. return is_moderator;
  232. end
  233. end
  234. --- Extracts the subdomain and room name from internal jid node [foo]room1
  235. -- @return subdomain(optional, if extracted or nil), the room name, the customer_id in case of vpaas
  236. function extract_subdomain(room_node)
  237. local ret = extract_subdomain_cache:get(room_node);
  238. if ret then
  239. return ret.subdomain, ret.room, ret.customer_id;
  240. end
  241. local subdomain, room_name = room_node:match("^%[([^%]]+)%](.+)$");
  242. local _, customer_id = subdomain and subdomain:match("^(vpaas%-magic%-cookie%-)(.*)$") or nil, nil;
  243. local cache_value = { subdomain=subdomain, room=room_name, customer_id=customer_id };
  244. extract_subdomain_cache:set(room_node, cache_value);
  245. return subdomain, room_name, customer_id;
  246. end
  247. function starts_with(str, start)
  248. if not str then
  249. return false;
  250. end
  251. return str:sub(1, #start) == start
  252. end
  253. function starts_with_one_of(str, prefixes)
  254. if not str or not prefixes then
  255. return false;
  256. end
  257. if is_set(prefixes) then
  258. -- set is a table with keys and value of true
  259. for k, _ in prefixes:items() do
  260. if starts_with(str, k) then
  261. return k;
  262. end
  263. end
  264. else
  265. for _, v in pairs(prefixes) do
  266. if starts_with(str, v) then
  267. return v;
  268. end
  269. end
  270. end
  271. return false
  272. end
  273. function ends_with(str, ending)
  274. return ending == "" or str:sub(-#ending) == ending
  275. end
  276. -- healthcheck rooms in jicofo starts with a string '__jicofo-health-check'
  277. function is_healthcheck_room(room_jid)
  278. return starts_with(room_jid, "__jicofo-health-check");
  279. end
  280. --- Utility function to make an http get request and
  281. --- retry @param retry number of times
  282. -- @param url endpoint to be called
  283. -- @param retry nr of retries, if retry is
  284. -- @param auth_token value to be passed as auth Bearer
  285. -- nil there will be no retries
  286. -- @returns result of the http call or nil if
  287. -- the external call failed after the last retry
  288. function http_get_with_retry(url, retry, auth_token)
  289. local content, code, cache_for;
  290. local timeout_occurred;
  291. local wait, done = async.waiter();
  292. local request_headers = http_headers or {}
  293. if auth_token ~= nil then
  294. request_headers['Authorization'] = 'Bearer ' .. auth_token
  295. end
  296. local function cb(content_, code_, response_, request_)
  297. if timeout_occurred == nil then
  298. code = code_;
  299. if code == 200 or code == 204 then
  300. -- module:log("debug", "External call was successful, content %s", content_);
  301. content = content_;
  302. -- if there is cache-control header, let's return the max-age value
  303. if response_ and response_.headers and response_.headers['cache-control'] then
  304. local vals = {};
  305. for k, v in response_.headers['cache-control']:gmatch('(%w+)=(%w+)') do
  306. vals[k] = v;
  307. end
  308. -- max-age=123 will be parsed by the regex ^ to age=123
  309. cache_for = vals.age;
  310. end
  311. else
  312. module:log("warn", "Error on GET request: Code %s, Content %s",
  313. code_, content_);
  314. end
  315. done();
  316. else
  317. module:log("warn", "External call reply delivered after timeout from: %s", url);
  318. end
  319. end
  320. local function call_http()
  321. return http.request(url, {
  322. headers = request_headers,
  323. method = "GET"
  324. }, cb);
  325. end
  326. local request = call_http();
  327. local function cancel()
  328. -- TODO: This check is racey. Not likely to be a problem, but we should
  329. -- still stick a mutex on content / code at some point.
  330. if code == nil then
  331. timeout_occurred = true;
  332. module:log("warn", "Timeout %s seconds making the external call to: %s", http_timeout, url);
  333. -- no longer present in prosody 0.11, so check before calling
  334. if http.destroy_request ~= nil then
  335. http.destroy_request(request);
  336. end
  337. if retry == nil then
  338. module:log("debug", "External call failed and retry policy is not set");
  339. done();
  340. elseif retry ~= nil and retry < 1 then
  341. module:log("debug", "External call failed after retry")
  342. done();
  343. else
  344. module:log("debug", "External call failed, retry nr %s", retry)
  345. retry = retry - 1;
  346. request = call_http()
  347. return http_timeout;
  348. end
  349. end
  350. end
  351. timer.add_task(http_timeout, cancel);
  352. wait();
  353. return content, code, cache_for;
  354. end
  355. -- Checks whether there is status in the <x node
  356. -- @param muc_x the <x element from presence
  357. -- @param status checks for this status
  358. -- @returns true if the status is found, false otherwise or if no muc_x is provided.
  359. function presence_check_status(muc_x, status)
  360. if not muc_x then
  361. return false;
  362. end
  363. for statusNode in muc_x:childtags('status') do
  364. if statusNode.attr.code == status then
  365. return true;
  366. end
  367. end
  368. return false;
  369. end
  370. -- Retrieves the focus from the room and cache it in the room object
  371. -- @param room The room name for which to find the occupant
  372. local function get_focus_occupant(room)
  373. return room:get_occupant_by_nick(room.jid..'/focus');
  374. end
  375. -- Checks whether the jid is moderated, the room name is in moderated_rooms
  376. -- or if the subdomain is in the moderated_subdomains
  377. -- @return returns on of the:
  378. -- -> false
  379. -- -> true, room_name, subdomain
  380. -- -> true, room_name, nil (if no subdomain is used for the room)
  381. function is_moderated(room_jid)
  382. if moderated_subdomains:empty() and moderated_rooms:empty() then
  383. return false;
  384. end
  385. local room_node = jid.node(room_jid);
  386. -- parses bare room address, for multidomain expected format is:
  387. -- [subdomain]roomName@conference.domain
  388. local target_subdomain, target_room_name = extract_subdomain(room_node);
  389. if target_subdomain then
  390. if moderated_subdomains:contains(target_subdomain) then
  391. return true, target_room_name, target_subdomain;
  392. end
  393. elseif moderated_rooms:contains(room_node) then
  394. return true, room_node, nil;
  395. end
  396. return false;
  397. end
  398. -- check if the room tenant starts with vpaas-magic-cookie-
  399. -- @param room the room to check
  400. function is_vpaas(room)
  401. if not room then
  402. return false;
  403. end
  404. -- stored check in room object if it exist
  405. if room.is_vpaas ~= nil then
  406. return room.is_vpaas;
  407. end
  408. room.is_vpaas = false;
  409. local node, host = jid.split(room.jid);
  410. if host ~= muc_domain or not node then
  411. return false;
  412. end
  413. local tenant, conference_name = node:match('^%[([^%]]+)%](.+)$');
  414. if not (tenant and conference_name) then
  415. return false;
  416. end
  417. if not starts_with(tenant, 'vpaas-magic-cookie-') then
  418. return false;
  419. end
  420. room.is_vpaas = true;
  421. return true;
  422. end
  423. -- Returns the initiator extension if the stanza is coming from a sip jigasi
  424. function is_sip_jigasi(stanza)
  425. if not stanza then
  426. return false;
  427. end
  428. return stanza:get_child('initiator', 'http://jitsi.org/protocol/jigasi');
  429. end
  430. -- This requires presence stanza being passed
  431. function is_transcriber_jigasi(stanza)
  432. if not stanza then
  433. return false;
  434. end
  435. local features = stanza:get_child('features');
  436. if not features then
  437. return false;
  438. end
  439. for i = 1, #features do
  440. local feature = features[i];
  441. if feature.attr and feature.attr.var and feature.attr.var == 'http://jitsi.org/protocol/transcriber' then
  442. return true;
  443. end
  444. end
  445. return false;
  446. end
  447. function is_transcriber(jid)
  448. return starts_with_one_of(jid, TRANSCRIBER_PREFIXES);
  449. end
  450. function get_sip_jibri_email_prefix(email)
  451. if not email then
  452. return nil;
  453. elseif starts_with_one_of(email, INBOUND_SIP_JIBRI_PREFIXES) then
  454. return starts_with_one_of(email, INBOUND_SIP_JIBRI_PREFIXES);
  455. elseif starts_with_one_of(email, OUTBOUND_SIP_JIBRI_PREFIXES) then
  456. return starts_with_one_of(email, OUTBOUND_SIP_JIBRI_PREFIXES);
  457. else
  458. return nil;
  459. end
  460. end
  461. function is_sip_jibri_join(stanza)
  462. if not stanza then
  463. return false;
  464. end
  465. local features = stanza:get_child('features');
  466. local email = stanza:get_child_text('email');
  467. if not features or not email then
  468. return false;
  469. end
  470. for i = 1, #features do
  471. local feature = features[i];
  472. if feature.attr and feature.attr.var and feature.attr.var == "http://jitsi.org/protocol/jibri" then
  473. if get_sip_jibri_email_prefix(email) then
  474. module:log("debug", "Occupant with email %s is a sip jibri ", email);
  475. return true;
  476. end
  477. end
  478. end
  479. return false
  480. end
  481. function is_jibri(occupant)
  482. return starts_with_one_of(type(occupant) == "string" and occupant or occupant.jid, RECORDER_PREFIXES)
  483. end
  484. -- process a host module directly if loaded or hooks to wait for its load
  485. function process_host_module(name, callback)
  486. local function process_host(host)
  487. if host == name then
  488. callback(module:context(host), host);
  489. end
  490. end
  491. if prosody.hosts[name] == nil then
  492. module:log('info', 'No host/component found, will wait for it: %s', name)
  493. -- when a host or component is added
  494. prosody.events.add_handler('host-activated', process_host);
  495. else
  496. process_host(name);
  497. end
  498. end
  499. function table_shallow_copy(t)
  500. local t2 = {}
  501. for k, v in pairs(t) do
  502. t2[k] = v
  503. end
  504. return t2
  505. end
  506. -- Splits a string using delimiter
  507. function split_string(str, delimiter)
  508. str = str .. delimiter;
  509. local result = array();
  510. for w in str:gmatch("(.-)" .. delimiter) do
  511. result:push(w);
  512. end
  513. return result;
  514. end
  515. -- send iq result that the iq was received and will be processed
  516. function respond_iq_result(origin, stanza)
  517. -- respond with successful receiving the iq
  518. origin.send(st.iq({
  519. type = 'result';
  520. from = stanza.attr.to;
  521. to = stanza.attr.from;
  522. id = stanza.attr.id
  523. }));
  524. end
  525. -- Note: http_server.get_request_from_conn() was added in Prosody 0.12.3,
  526. -- this code provides backwards compatibility with older versions
  527. local get_request_from_conn = http_server.get_request_from_conn or function (conn)
  528. local response = conn and conn._http_open_response;
  529. return response and response.request or nil;
  530. end;
  531. -- Discover real remote IP of a session
  532. function get_ip(session)
  533. local request = get_request_from_conn(session.conn);
  534. return request and request.ip or session.ip;
  535. end
  536. return {
  537. OUTBOUND_SIP_JIBRI_PREFIXES = OUTBOUND_SIP_JIBRI_PREFIXES;
  538. INBOUND_SIP_JIBRI_PREFIXES = INBOUND_SIP_JIBRI_PREFIXES;
  539. RECORDER_PREFIXES = RECORDER_PREFIXES;
  540. extract_subdomain = extract_subdomain;
  541. is_feature_allowed = is_feature_allowed;
  542. is_jibri = is_jibri;
  543. is_healthcheck_room = is_healthcheck_room;
  544. is_moderated = is_moderated;
  545. is_sip_jibri_join = is_sip_jibri_join;
  546. is_sip_jigasi = is_sip_jigasi;
  547. is_transcriber = is_transcriber;
  548. is_transcriber_jigasi = is_transcriber_jigasi;
  549. is_vpaas = is_vpaas;
  550. get_focus_occupant = get_focus_occupant;
  551. get_ip = get_ip;
  552. get_room_from_jid = get_room_from_jid;
  553. get_room_by_name_and_subdomain = get_room_by_name_and_subdomain;
  554. get_sip_jibri_email_prefix = get_sip_jibri_email_prefix;
  555. async_handler_wrapper = async_handler_wrapper;
  556. presence_check_status = presence_check_status;
  557. process_host_module = process_host_module;
  558. respond_iq_result = respond_iq_result;
  559. room_jid_match_rewrite = room_jid_match_rewrite;
  560. room_jid_split_subdomain = room_jid_split_subdomain;
  561. internal_room_jid_match_rewrite = internal_room_jid_match_rewrite;
  562. update_presence_identity = update_presence_identity;
  563. http_get_with_retry = http_get_with_retry;
  564. ends_with = ends_with;
  565. split_string = split_string;
  566. starts_with = starts_with;
  567. starts_with_one_of = starts_with_one_of;
  568. table_shallow_copy = table_shallow_copy;
  569. };