Browse Source

HTTP REST: minor fixes

1) const-ify internal helper ParseHashStr()

2) use HTTPError() helper when returning HTTP_NOT_FOUND
tags/v0.15.1
Jeff Garzik 5 years ago
parent
commit
7715c84747
Failed to extract signature
2 changed files with 3 additions and 3 deletions
  1. 2
    2
      src/rest.cpp
  2. 1
    1
      src/rpcserver.cpp

+ 2
- 2
src/rest.cpp View File

@@ -56,7 +56,7 @@ static enum RetFormat ParseDataFormat(const string& format)
return rf_names[0].rf;
}

static bool ParseHashStr(string& strReq, uint256& v)
static bool ParseHashStr(const string& strReq, uint256& v)
{
if (!IsHex(strReq) || (strReq.size() != 64))
return false;
@@ -195,7 +195,7 @@ bool HTTPReq_REST(AcceptedConnection *conn,
return false;
}

conn->stream() << HTTPReply(HTTP_NOT_FOUND, "", false) << std::flush;
conn->stream() << HTTPError(HTTP_NOT_FOUND, false) << std::flush;
return false;
}


+ 1
- 1
src/rpcserver.cpp View File

@@ -957,7 +957,7 @@ void ServiceConnection(AcceptedConnection *conn)
break;

} else {
conn->stream() << HTTPReply(HTTP_NOT_FOUND, "", false) << std::flush;
conn->stream() << HTTPError(HTTP_NOT_FOUND, false) << std::flush;
break;
}
}

Loading…
Cancel
Save