mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
Merge remote-tracking branch 'upstream/santiago' into santiago
This commit is contained in:
commit
3309ec1868
@ -58,7 +58,7 @@ class Listener(santiago.SantiagoListener):
|
|||||||
d.connect("index", "/", self.index)
|
d.connect("index", "/", self.index)
|
||||||
d.connect("learn", "/learn/:host/:service", self.learn)
|
d.connect("learn", "/learn/:host/:service", self.learn)
|
||||||
d.connect("where", "/where/:host/:service", self.where)
|
d.connect("where", "/where/:host/:service", self.where)
|
||||||
d.connect("provide", "/provide/:host/:service/:location", self.provide)
|
d.connect("provide", "/provide/:client/:service/:location", self.provide)
|
||||||
|
|
||||||
cherrypy.tree.mount(cherrypy.Application(self), "",
|
cherrypy.tree.mount(cherrypy.Application(self), "",
|
||||||
{"/": {"request.dispatch": d}})
|
{"/": {"request.dispatch": d}})
|
||||||
|
|||||||
@ -22,8 +22,6 @@ We don't:
|
|||||||
- Use a reasonable data-store.
|
- Use a reasonable data-store.
|
||||||
- Have a decent control (rate-limiting) mechanism.
|
- Have a decent control (rate-limiting) mechanism.
|
||||||
|
|
||||||
:FIXME: Remove sets and just do "key in" operations - it's annoying to remember
|
|
||||||
to convert to and from sets with every operation. Or just build a wrapper.
|
|
||||||
:TODO: add doctests
|
:TODO: add doctests
|
||||||
:FIXME: allow multiple listeners and senders per protocol (with different
|
:FIXME: allow multiple listeners and senders per protocol (with different
|
||||||
proxies)
|
proxies)
|
||||||
@ -57,6 +55,7 @@ import cfg
|
|||||||
from collections import defaultdict as DefaultDict
|
from collections import defaultdict as DefaultDict
|
||||||
import gnupg
|
import gnupg
|
||||||
import inspect
|
import inspect
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import shelve
|
import shelve
|
||||||
@ -302,8 +301,7 @@ class Santiago(object):
|
|||||||
self.requests[host].add(service)
|
self.requests[host].add(service)
|
||||||
|
|
||||||
request = self.gpg.encrypt(
|
request = self.gpg.encrypt(
|
||||||
# TODO json this.
|
json.dumps({ "host": host, "client": client,
|
||||||
str({ "host": host, "client": client,
|
|
||||||
"service": service, "locations": list(locations or ""),
|
"service": service, "locations": list(locations or ""),
|
||||||
"reply_to": list(reply_to),
|
"reply_to": list(reply_to),
|
||||||
"request_version": 1,
|
"request_version": 1,
|
||||||
@ -382,7 +380,6 @@ class Santiago(object):
|
|||||||
understand.
|
understand.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# TODO json -> python
|
|
||||||
request = self.gpg.decrypt(request)
|
request = self.gpg.decrypt(request)
|
||||||
|
|
||||||
# skip badly signed messages or ones for other folks.
|
# skip badly signed messages or ones for other folks.
|
||||||
@ -393,7 +390,7 @@ class Santiago(object):
|
|||||||
|
|
||||||
# copy out only required keys from request, throwing away cruft
|
# copy out only required keys from request, throwing away cruft
|
||||||
request_body = dict()
|
request_body = dict()
|
||||||
source = ast.literal_eval(str(request))
|
source = json.loads((str(request)))
|
||||||
try:
|
try:
|
||||||
for key in Santiago.ALL_KEYS:
|
for key in Santiago.ALL_KEYS:
|
||||||
request_body[key] = source[key]
|
request_body[key] = source[key]
|
||||||
@ -407,7 +404,8 @@ class Santiago(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# versions must overlap.
|
# versions must overlap.
|
||||||
if not (Santiago.SUPPORTED_PROTOCOLS & request_body["reply_versions"]):
|
if not (Santiago.SUPPORTED_PROTOCOLS &
|
||||||
|
set(request_body["reply_versions"])):
|
||||||
return
|
return
|
||||||
if not (Santiago.SUPPORTED_PROTOCOLS &
|
if not (Santiago.SUPPORTED_PROTOCOLS &
|
||||||
set([request_body["request_version"]])):
|
set([request_body["request_version"]])):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user