Software /
code /
prosody
Annotate
plugins/mod_stanza_debug.lua @ 11063:30d3f6f85eb8 0.11
net.server: Backport client parts of SNI support from trunk (#409)
Partial backports of the following commits from trunk:
6c804b6b2ca2 net.http: Pass server name along for SNI (fixes #1408)
75d2874502c3 net.server_select: SNI support (#409)
9a905888b96c net.server_event: Add SNI support (#409)
adc0672b700e net.server_epoll: Add support for SNI (#409)
d4390c427a66 net.server: Handle server name (SNI) as extra argument
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 17 Aug 2020 23:01:14 +0200 |
parent | 8348:c3de5b454ec4 |
child | 10111:0f335815244f |
rev | line source |
---|---|
8348
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 module:set_global(); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 local tostring = tostring; |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 local filters = require "util.filters"; |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 local function log_send(t, session) |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 if t and t ~= "" and t ~= " " then |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 session.log("debug", "SEND: %s", tostring(t)); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 end |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 return t; |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 end |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 local function log_recv(t, session) |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 if t and t ~= "" and t ~= " " then |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 session.log("debug", "RECV: %s", tostring(t)); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 end |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 return t; |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 end |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 local function init_raw_logging(session) |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 filters.add_filter(session, "stanzas/in", log_recv, -10000); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 filters.add_filter(session, "stanzas/out", log_send, 10000); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 end |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 filters.add_filter_hook(init_raw_logging); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 function module.unload() |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 filters.remove_filter_hook(init_raw_logging); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 end |