Commit aa67900a authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

jsonrpc: make "jsonrpc" request field optional

The "jsonrpc" field, per spec, is meant to contain the exact string
"2.0" to indicate the version of the JSON-RPC specification implemented
by the client.  We don't do anything useful with this information except
to drop requests for (theoretical) other versions, so it should be safe
to allow the parameter to be optional.  If the version is specified, we
will still validate that it is 2.0.

This enables interoperability with a Go JSON-RPC client, as mentioned in
issue #303: https://godoc.org/github.com/mafredri/cdp/rpcc



Change-Id: Ifde32b3f47a5d7942f4ab74b4d6029dd0168efa8
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/411742


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 70047789
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -71,8 +71,8 @@ parse_single_request(struct spdk_jsonrpc_request *request, struct spdk_json_val
		goto done;
	}

	if (!req.version || req.version->type != SPDK_JSON_VAL_STRING ||
	    !spdk_json_strequal(req.version, "2.0")) {
	if (req.version && (req.version->type != SPDK_JSON_VAL_STRING ||
			    !spdk_json_strequal(req.version, "2.0"))) {
		invalid = true;
	}