Software /
code /
prosody
Annotate
spec/scansion/presence_preapproval.scs @ 12790:24b55f0e2db9 0.12
mod_http: Allow disabling CORS in the http_cors_override option and by default
Fixes #1779.
Due to an oversight in the logic, if the user set 'enabled' to false in an
override, it would disable the item's requested CORS settings, but still apply
Prosody's default CORS policy.
This change ensures that 'enabled = false' will now disable CORS entirely for
the requested item.
Due to the new structure of the code, it was necessary to have a flag to say
whether CORS is to be applied at all. Rather than hard-coding 'true' here, I
chose to add a new option: 'http_default_cors_enabled'. This is a boolean that
allows the operator to disable Prosody's default CORS policy entirely (the one
that is used when a module or config does not override it). This makes it
easier to disable CORS and then selectively enable it only on services you
want it on.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 31 Oct 2022 14:32:02 +0000 |
parent | 10515:35bf3b80480f |
rev | line source |
---|---|
10514
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 # server supports contact subscription pre-approval (RFC 6121 3.4) |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 [Client] Alice |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 jid: preappove-a@localhost |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 password: password |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 [Client] Bob |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 jid: preapprove-b@localhost |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 password: password |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 --------- |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 Alice connects |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 Alice sends: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
16 <presence/> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
17 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 Alice receives: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 <presence/> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 Alice sends: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 <presence to="${Bob's JID}" type="subscribed"/> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
24 Bob connects |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
26 Bob sends: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
27 <iq type="get" id="roster1"> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 <query xmlns="jabber:iq:roster"/> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 </iq> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
31 Bob receives: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 <iq type="result" id="roster1"> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
33 <query xmlns="jabber:iq:roster" ver="{scansion:any}"> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
34 </query> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
35 </iq> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 Bob sends: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
38 <presence/> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
39 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
40 Bob receives: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
41 <presence from="${Bob's full JID}"/> |
10515
35bf3b80480f
scansion: Trim trailing whitespace in tests
Kim Alvefur <zash@zash.se>
parents:
10514
diff
changeset
|
42 |
10514
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
43 Bob sends: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
44 <presence to="${Alice's JID}" type="subscribe" /> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
45 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
46 Bob receives: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
47 <iq type='set' id='{scansion:any}'> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
48 <query ver='1' xmlns='jabber:iq:roster'> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
49 <item jid="${Alice's JID}" subscription='none' ask='subscribe' /> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
50 </query> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
51 </iq> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
52 |
10515
35bf3b80480f
scansion: Trim trailing whitespace in tests
Kim Alvefur <zash@zash.se>
parents:
10514
diff
changeset
|
53 |
10514
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
54 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
55 Bob receives: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
56 <presence from="${Alice's JID}" type="subscribed" /> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
57 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
58 Bob disconnects |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
59 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
60 Alice sends: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
61 <iq type="get" id="roster1"> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
62 <query xmlns="jabber:iq:roster"/> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
63 </iq> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
64 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
65 Alice receives: |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
66 <iq type="result" id="roster1"> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
67 <query xmlns="jabber:iq:roster" ver="{scansion:any}"> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
68 <item jid="${Bob's JID}" subscription="from" /> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
69 </query> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
70 </iq> |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
71 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
72 Alice disconnects |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
73 |
f0e9e5bda415
rostermanager, mod_presence: Support for subscription preapproval (fixes #686)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
74 Bob disconnects |