Mercurial > prosody-modules
annotate mod_pubsub_get/mod_pubsub_get.lua @ 6319:04c3273cb81f
mod_auth_cyrus: Add empty 'profile' table to SASL handler objects
This is for compatibility with Prosody's built-in util.sasl objects.
A SASL profile table usually includes methods supported by the backend, which
can be used by SASL mechanism handlers to perform operations (such as testing
the password). It also optionally contains a 'cb' field with channel binding
method handlers.
The Cyrus backend doesn't support channel binding, and doesn't have the same
concept of auth backend methods (it handles all that internally, and Prosody
has no insight or control over it).
Thus, we create an empty profile which informs Prosody that the SASL handler
does not support any of the auth or channel binding methods. Some features
will not work, but they didn't work anyway. This just makes it explicit.
This fixes a traceback in mod_sasl2_fast, which expected SASL handlers to
always contain a 'profile' field.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 04 Sep 2025 10:14:46 +0100 |
| parents | 119c0eb65bf3 |
| children |
| rev | line source |
|---|---|
|
6176
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
1 module:depends("http") |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
2 local pubsub_service = module:depends("pubsub").service |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
3 local json = require "util.json" |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
4 |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
5 function handle_GET(event) |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
6 local request, response = event.request, event.response |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
7 local query = request.url.query |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
8 |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
9 if query:sub(1, 5) ~= "node=" then return 400 end |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
10 |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
11 local node = query:sub(6) |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
12 local ok, items = pubsub_service:get_items(node, true) |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
13 |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
14 if not ok then return 404 end |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
15 response.status_code = 200 |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
16 return json.encode(items) |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
17 end |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
18 |
|
119c0eb65bf3
mod_pubsub: new module to fetch pubsub items via HTTP GET
nicoco <nicoco@nicoco.fr>
parents:
diff
changeset
|
19 module:provides("http", {route = {GET = handle_GET}}) |
