electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 6be7bda0230ee1d4bf3aa4ac0db604a7eeb6ea34
parent 1fe18ab1cedbed9cc4f296e563fec1b2bdaa5619
Author: ThomasV <thomasv@electrum.org>
Date:   Sat,  6 Jan 2018 20:51:55 +0100

Merge pull request #3659 from mithrandi/patch-1

Stop allowing CORS for the JSON-RPC server
Diffstat:
Mlib/daemon.py | 17++---------------
1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/lib/daemon.py b/lib/daemon.py @@ -28,7 +28,7 @@ import time # from jsonrpc import JSONRPCResponseManager import jsonrpclib -from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer, SimpleJSONRPCRequestHandler +from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer from .version import ELECTRUM_VERSION from .network import Network @@ -87,19 +87,6 @@ def get_server(config): time.sleep(1.0) -class RequestHandler(SimpleJSONRPCRequestHandler): - - def do_OPTIONS(self): - self.send_response(200) - self.end_headers() - - def end_headers(self): - self.send_header("Access-Control-Allow-Headers", - "Origin, X-Requested-With, Content-Type, Accept") - self.send_header("Access-Control-Allow-Origin", "*") - SimpleJSONRPCRequestHandler.end_headers(self) - - class Daemon(DaemonThread): def __init__(self, config, fd): @@ -124,7 +111,7 @@ class Daemon(DaemonThread): host = config.get('rpchost', '127.0.0.1') port = config.get('rpcport', 0) try: - server = SimpleJSONRPCServer((host, port), logRequests=False, requestHandler=RequestHandler) + server = SimpleJSONRPCServer((host, port), logRequests=False) except Exception as e: self.print_error('Warning: cannot initialize RPC server on host', host, e) self.server = None