Browse Source

json-rpc: Return a standard compliant error when parsing fails

The JSON-RPC spec specifies that if the request is unparseable we
should return an error with a NULL id. This is a bit more friendly
than slamming the door in the face.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
parent
commit
5a133d2d70
  1. 5
      lightningd/jsonrpc.c

5
lightningd/jsonrpc.c

@ -660,7 +660,10 @@ again:
log_unusual(jcon->ld->log,
"Invalid token in json input: '%.*s'",
(int)jcon->used, jcon->buffer);
return io_close(conn);
json_command_malformed(
jcon, NULL,
"Invalid token in json input");
return io_halfclose(conn);
}
/* We need more. */
goto read_more;

Loading…
Cancel
Save