8000 HttpClient::SendRPCMessage() throws ERROR_RPC_INTERNAL for successful HTTP responses · Issue #278 · cinemast/libjson-rpc-cpp · GitHub
[go: up one dir, main page]

Skip to content
HttpClient::SendRPCMessage() throws ERROR_RPC_INTERNAL for successful HTTP responses #278
@rlebeau

Description

@rlebeau

HttpClient::SendRPCMessage() throws an ERROR_RPC_INTERNAL exception on all HTTP 2xx responses other than 200:

  long http_code = 0;
  curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);

  if (http_code != 200) {
    throw JsonRpcException(Errors::ERROR_RPC_INTERNAL_ERROR, result);
  }

A user is experiencing a situation where an RPC server is returning a 201 response, see https://stackoverflow.com/questions/57492037/. The request is successful, but SendRPCMessage() fails.

The check of the http_code value should be more like this instead:

  if ((http_code / 100) != 2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0