Files
lotherk 624fcf3d48 a2a: URL text parts and push-config CRUD; .local/lib untangled
A text/plain url part is fetched from loopback or a host in
SPLINTER_A2A_URL_ALLOW (1 MiB, no redirects); binary and other media
types stay refused. The four push-config methods create/get/list/delete
in-memory configs per task.

~/.local/lib is a real directory now: libsplinter.so plus a node_modules
symlink to ../npm/node_modules. The npm tree is not leftover -- it is
the mcp-local-memory MCP server and the Python user dirs -- so npm
root -g, the module and the installed splinter are verified working;
nothing was deleted.

Full make check green.
2026-11-10 08:49:27 +00:00

33 lines
1.1 KiB
Python

# fake A2A push receiver for tests/test_a2a_server.sh.
# argv: port, log file. One POST per notification.
import http.server, sys
class H(http.server.BaseHTTPRequestHandler):
def log_message(self, *a):
pass
def do_GET(self):
b = b"hallo aus datei\n"
self.send_response(200)
self.send_header("Content-Type", "text/plain")
self.send_header("Content-Length", str(len(b)))
self.end_headers()
self.wfile.write(b)
with open(sys.argv[2], "a") as f:
f.write("get %s\n" % self.path)
def do_POST(self):
n = int(self.headers.get("Content-Length", 0))
body = self.rfile.read(n).decode("utf-8", "replace")
auth = self.headers.get("Authorization", "")
tok = self.headers.get("X-A2A-Notification-Token", "")
with open(sys.argv[2], "a") as f:
f.write("auth=%s token=%s body=%s\n" % (auth, tok, body))
self.send_response(200)
self.send_header("Content-Length", "0")
self.end_headers()
http.server.ThreadingHTTPServer(("127.0.0.1", int(sys.argv[1])), H).serve_forever()