Software /
code /
prosody
Annotate
tools/dnsregistry.lua @ 12894:0598d822614f 0.12 0.12.3
mod_websocket: Fire pre-session-close event (fixes #1800)
This event was added in a7c183bb4e64 and is required to make mod_smacks know
that a session was intentionally closed and shouldn't be hibernated (see
fcea4d9e7502).
Because this was missing from mod_websocket's session.close(), mod_smacks
would always attempt to hibernate websocket sessions even if they closed
cleanly.
That mod_websocket has its own copy of session.close() is something to fix
another day (probably not in the stable branch). So for now this commit makes
the minimal change to get things working again.
Thanks to Damian and the Jitsi team for reporting.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 20 Feb 2023 18:10:15 +0000 |
parent | 12271:f31bb79f51d7 |
child | 12855:3306807c0619 |
rev | line source |
---|---|
12237
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 -- Generate util/dnsregistry.lua from IANA HTTP status code registry |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 local xml = require "util.xml"; |
12271
f31bb79f51d7
tools: Allow processing instructions in some XML parsing tools
Kim Alvefur <zash@zash.se>
parents:
12237
diff
changeset
|
3 local registries = xml.parse(io.read("*a"), { allow_processing_instructions = true }); |
12237
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 print("-- Source: https://www.iana.org/assignments/dns-parameters/dns-parameters.xml"); |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 print(os.date("-- Generated on %Y-%m-%d")) |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 local registry_mapping = { |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 ["dns-parameters-2"] = "classes"; |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 ["dns-parameters-4"] = "types"; |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 ["dns-parameters-6"] = "errors"; |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 }; |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 print("return {"); |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 for registry in registries:childtags("registry") do |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 local registry_name = registry_mapping[registry.attr.id]; |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 if registry_name then |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 print("\t" .. registry_name .. " = {"); |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 for record in registry:childtags("record") do |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 local record_name = record:get_child_text("name"); |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 local record_type = record:get_child_text("type"); |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 local record_desc = record:get_child_text("description"); |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 local record_code = tonumber(record:get_child_text("value")); |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 if tostring(record):lower():match("reserved") or tostring(record):lower():match("reserved") then |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 record_code = nil; |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 end |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 if registry_name == "classes" and record_code then |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
30 record_type = record_desc and record_desc:match("%((%w+)%)$") |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
31 if record_type then |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
32 print(("\t\t[%q] = %d; [%d] = %q;"):format(record_type, record_code, record_code, record_type)) |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 end |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
34 elseif registry_name == "types" and record_type and record_code then |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 print(("\t\t[%q] = %d; [%d] = %q;"):format(record_type, record_code, record_code, record_type)) |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
36 elseif registry_name == "errors" and record_code and record_name then |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 print(("\t\t[%d] = %q; [%q] = %q;"):format(record_code, record_name, record_name, record_desc or record_name)); |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
38 end |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 end |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 print("\t};"); |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
41 end |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
42 end |
b35714c57442
tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
43 print("};"); |