HaikuDepot: Switch to v2 API

This switches to a new API format "v2" being introduced
on HDS.  The version of the application is also bumped
at the same time in order to make a later cut-off point
possible for compatibility.

Change-Id: I577fd143ac9d001171bca7213c82e3280af1c4de
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4217
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Andrew Lindesay 2021-07-18 20:32:48 +12:00
parent e5fb17f0ca
commit 21df7324c9
5 changed files with 91 additions and 209 deletions

View File

@ -8,7 +8,7 @@ resource app_flags B_SINGLE_LAUNCH;
resource app_version {
major = 0,
middle = 0,
minor = 4,
minor = 5,
variety = B_APPV_ALPHA,
internal = 1,

View File

@ -15,6 +15,7 @@
#include <NetworkInterface.h>
#include <NetworkRoster.h>
#include "Logger.h"
#include "HaikuDepotConstants.h"
#include "ServerSettings.h"
#include "WebAppInterface.h"
@ -224,11 +225,7 @@ ServerHelper::IsPlatformNetworkAvailable()
* ...
* "error": {
* "code": -32800,
* "data": {
"validationfailures": [
{ "property": "nickname", "message": "required" },
...
]
* "data": { "nickname": "required" }
},
...
* }
@ -237,7 +234,7 @@ ServerHelper::IsPlatformNetworkAvailable()
*
* \param failures is the object into which the validation failures are to be
* written.
* \param responseEnvelopeMessage is a representation of the entire JSON-RPC
* \param responseEnvelopeMessage is a representation of the entire
* response sent back from the server when the error occurred.
*
*/
@ -252,35 +249,26 @@ ServerHelper::GetFailuresFromJsonRpcError(
BMessage dataMessage;
if (errorMessage.FindMessage("data", &dataMessage) == B_OK) {
BMessage validationFailuresMessage;
if (dataMessage.FindMessage("validationfailures",
&validationFailuresMessage) == B_OK) {
_GetFailuresFromJsonRpcFailures(failures,
validationFailuresMessage);
// the names and values (strings) are key-value pairs indicating
// the error.
int32 i = 0;
BMessage dataItemMessage;
while (dataMessage.FindMessage(BString() << i, &dataItemMessage)
== B_OK) {
BString key;
BString value;
if (dataItemMessage.FindString("key", &key) == B_OK
&& dataItemMessage.FindString("value", &value) == B_OK) {
failures.AddFailure(key, value);
} else {
HDERROR("possibly corrupt validation message missing key "
"or value");
}
i++;
}
}
}
}
/*static*/ void
ServerHelper::_GetFailuresFromJsonRpcFailures(
ValidationFailures& failures, BMessage& jsonRpcFailures)
{
int32 index = 0;
while (true) {
BString name;
name << index++;
BMessage failure;
if (jsonRpcFailures.FindMessage(name, &failure) != B_OK)
break;
BString property;
BString message;
if (failure.FindString("property", &property) == B_OK
&& failure.FindString("message", &message) == B_OK) {
failures.AddFailure(property, message);
}
}
}

View File

@ -35,11 +35,6 @@ public:
static void GetFailuresFromJsonRpcError(
ValidationFailures& failures,
BMessage& responseEnvelopeMessage);
private:
static void _GetFailuresFromJsonRpcFailures(
ValidationFailures& failures,
BMessage& jsonRpcFailures);
};
#endif // SERVER_HELPER_H

View File

@ -31,6 +31,7 @@ using namespace BPrivate::Network;
#define BASEURL_DEFAULT "https://depot.haiku-os.org"
#define USERAGENT_FALLBACK_VERSION "0.0.0"
#define PROTOCOL_NAME "post-json"
#define LOG_PAYLOAD_LIMIT 8192
@ -81,7 +82,7 @@ public:
virtual void DebugMessage(BUrlRequest* caller,
BUrlProtocolDebugMessage type, const char* text)
{
HDTRACE("jrpc: %s", text);
HDTRACE("post-json: %s", text);
}
};
@ -160,22 +161,13 @@ WebAppInterface::GetChangelog(const BString& packageName, BMessage& message)
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter,
"getPkgChangelog");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
requestEnvelopeWriter.WriteObjectName("pkgName");
requestEnvelopeWriter.WriteString(packageName.String());
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
return _SendJsonRequest("pkg", requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), 0,
message);
return _SendJsonRequest("pkg/get-pkg-change-log",
requestEnvelopeData, _LengthAndSeekToZero(requestEnvelopeData),
0, message);
}
@ -189,12 +181,6 @@ WebAppInterface::RetreiveUserRatingsForPackageForDisplay(
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter,
"searchUserRatings");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
requestEnvelopeWriter.WriteObjectName("pkgName");
requestEnvelopeWriter.WriteString(packageName.String());
requestEnvelopeWriter.WriteObjectName("offset");
@ -207,13 +193,11 @@ WebAppInterface::RetreiveUserRatingsForPackageForDisplay(
requestEnvelopeWriter.WriteString(webAppRepositoryCode);
}
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
return _SendJsonRequest("userrating", requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), 0,
message);
return _SendJsonRequest("user-rating/search-user-ratings",
requestEnvelopeData, _LengthAndSeekToZero(requestEnvelopeData),
0, message);
}
@ -227,12 +211,6 @@ WebAppInterface::RetreiveUserRatingForPackageAndVersionByUser(
BMallocIO* requestEnvelopeData = new BMallocIO();
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter,
"getUserRatingByUserAndPkgVersion");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
requestEnvelopeWriter.WriteObjectName("userNickname");
@ -269,11 +247,11 @@ WebAppInterface::RetreiveUserRatingForPackageAndVersionByUser(
requestEnvelopeWriter.WriteInteger(version.Revision());
}
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
return _SendJsonRequest("userrating", requestEnvelopeData,
return _SendJsonRequest(
"user-rating/get-user-rating-by-user-and-pkg-version",
requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), NEEDS_AUTHORIZATION,
message);
}
@ -298,20 +276,14 @@ WebAppInterface::RetrieveUserDetailForCredentials(
BMallocIO* requestEnvelopeData = new BMallocIO();
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter, "getUser");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
requestEnvelopeWriter.WriteObjectName("nickname");
requestEnvelopeWriter.WriteString(credentials.Nickname().String());
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
status_t result = _SendJsonRequest("user", credentials, requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), NEEDS_AUTHORIZATION,
message);
status_t result = _SendJsonRequest("user/get-user", credentials,
requestEnvelopeData, _LengthAndSeekToZero(requestEnvelopeData),
NEEDS_AUTHORIZATION, message);
// note that the credentials used here are passed in as args.
return result;
@ -445,27 +417,18 @@ WebAppInterface::AgreeUserUsageConditions(const BString& code,
BMallocIO* requestEnvelopeData = new BMallocIO();
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter,
"agreeUserUsageConditions");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
requestEnvelopeWriter.WriteObjectName("userUsageConditionsCode");
requestEnvelopeWriter.WriteString(code.String());
requestEnvelopeWriter.WriteObjectName("nickname");
requestEnvelopeWriter.WriteString(fCredentials.Nickname());
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
// now fetch this information into an object.
return _SendJsonRequest("user", requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), NEEDS_AUTHORIZATION,
responsePayload);
return _SendJsonRequest("user/agree-user-usage-conditions",
requestEnvelopeData, _LengthAndSeekToZero(requestEnvelopeData),
NEEDS_AUTHORIZATION, responsePayload);
}
@ -476,12 +439,6 @@ WebAppInterface::_RetrieveUserUsageConditionsMeta(const BString& code,
BMallocIO* requestEnvelopeData = new BMallocIO();
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter,
"getUserUsageConditions");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
if (!code.IsEmpty()) {
@ -489,14 +446,13 @@ WebAppInterface::_RetrieveUserUsageConditionsMeta(const BString& code,
requestEnvelopeWriter.WriteString(code.String());
}
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
// now fetch this information into an object.
return _SendJsonRequest("user", requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), 0, message);
return _SendJsonRequest("user/get-user-usage-conditions",
requestEnvelopeData, _LengthAndSeekToZero(requestEnvelopeData),
0, message);
}
@ -517,16 +473,10 @@ WebAppInterface::CreateUserRating(const BString& packageName,
const BString& languageCode, const BString& comment,
const BString& stability, int rating, BMessage& message)
{
// BHttpRequest later takes ownership of this.
BMallocIO* requestEnvelopeData = new BMallocIO();
// BHttpRequest later takes ownership of this.
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter,
"createUserRating");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
requestEnvelopeWriter.WriteObjectName("pkgName");
requestEnvelopeWriter.WriteString(packageName.String());
@ -581,13 +531,11 @@ WebAppInterface::CreateUserRating(const BString& packageName,
requestEnvelopeWriter.WriteString(comment.String());
}
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
return _SendJsonRequest("userrating", requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), NEEDS_AUTHORIZATION,
message);
return _SendJsonRequest("user-rating/create-user-rating",
requestEnvelopeData, _LengthAndSeekToZero(requestEnvelopeData),
NEEDS_AUTHORIZATION, message);
}
@ -596,17 +544,10 @@ WebAppInterface::UpdateUserRating(const BString& ratingID,
const BString& languageCode, const BString& comment,
const BString& stability, int rating, bool active, BMessage& message)
{
// BHttpRequest later takes ownership of this.
BMallocIO* requestEnvelopeData = new BMallocIO();
// BHttpRequest later takes ownership of this.
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter,
"updateUserRating");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
requestEnvelopeWriter.WriteObjectName("code");
@ -640,13 +581,11 @@ WebAppInterface::UpdateUserRating(const BString& ratingID,
requestEnvelopeWriter.WriteString(comment);
}
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
return _SendJsonRequest("userrating", requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), NEEDS_AUTHORIZATION,
message);
return _SendJsonRequest("user-rating/update-user-rating",
requestEnvelopeData, _LengthAndSeekToZero(requestEnvelopeData),
NEEDS_AUTHORIZATION, message);
}
@ -668,18 +607,11 @@ WebAppInterface::RequestCaptcha(BMessage& message)
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter,
"generateCaptcha");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
return _SendJsonRequest("captcha", requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), 0,
message);
return _SendJsonRequest("captcha/generate-captcha",
requestEnvelopeData, _LengthAndSeekToZero(requestEnvelopeData),
0, message);
}
@ -694,11 +626,6 @@ WebAppInterface::CreateUser(const BString& nickName,
BMallocIO* requestEnvelopeData = new BMallocIO();
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter, "createUser");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
requestEnvelopeWriter.WriteObjectName("nickname");
@ -719,11 +646,9 @@ WebAppInterface::CreateUser(const BString& nickName,
requestEnvelopeWriter.WriteString(email.String());
}
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
return _SendJsonRequest("user", requestEnvelopeData,
return _SendJsonRequest("user/create-user", requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), 0, message);
}
@ -736,11 +661,6 @@ WebAppInterface::AuthenticateUser(const BString& nickName,
// BHttpRequest later takes ownership of this.
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter,
"authenticateUser");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
requestEnvelopeWriter.WriteObjectName("nickname");
@ -748,13 +668,11 @@ WebAppInterface::AuthenticateUser(const BString& nickName,
requestEnvelopeWriter.WriteObjectName("passwordClear");
requestEnvelopeWriter.WriteString(passwordClear.String());
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
return _SendJsonRequest("user", requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), 0,
message);
return _SendJsonRequest("user/authenticate-user",
requestEnvelopeData, _LengthAndSeekToZero(requestEnvelopeData),
0, message);
}
@ -766,11 +684,6 @@ WebAppInterface::IncrementViewCounter(const PackageInfoRef package,
// BHttpRequest later takes ownership of this.
BJsonTextWriter requestEnvelopeWriter(requestEnvelopeData);
requestEnvelopeWriter.WriteObjectStart();
_WriteStandardJsonRpcEnvelopeValues(requestEnvelopeWriter,
"incrementViewCounter");
requestEnvelopeWriter.WriteObjectName("params");
requestEnvelopeWriter.WriteArrayStart();
requestEnvelopeWriter.WriteObjectStart();
requestEnvelopeWriter.WriteObjectName("architectureCode");
@ -803,13 +716,11 @@ WebAppInterface::IncrementViewCounter(const PackageInfoRef package,
static_cast<int64>(version.Revision()));
}
requestEnvelopeWriter.WriteObjectEnd();
requestEnvelopeWriter.WriteArrayEnd();
requestEnvelopeWriter.WriteObjectEnd();
return _SendJsonRequest("pkg", requestEnvelopeData,
_LengthAndSeekToZero(requestEnvelopeData), 0,
message);
return _SendJsonRequest("pkg/increment-view-counter",
requestEnvelopeData, _LengthAndSeekToZero(requestEnvelopeData),
0, message);
}
@ -839,54 +750,44 @@ WebAppInterface::ErrorCodeFromResponse(BMessage& responseEnvelopeMessage)
// #pragma mark - private
void
WebAppInterface::_WriteStandardJsonRpcEnvelopeValues(BJsonWriter& writer,
const char* methodName)
status_t
WebAppInterface::_SendJsonRequest(const char* urlPathComponents,
BPositionIO* requestData, size_t requestDataSize, uint32 flags,
BMessage& reply) const
{
writer.WriteObjectName("jsonrpc");
writer.WriteString("2.0");
writer.WriteObjectName("id");
writer.WriteInteger(++fRequestIndex);
writer.WriteObjectName("method");
writer.WriteString(methodName);
return _SendJsonRequest(urlPathComponents, fCredentials, requestData,
requestDataSize, flags, reply);
}
status_t
WebAppInterface::_SendJsonRequest(const char* domain, BPositionIO* requestData,
size_t requestDataSize, uint32 flags, BMessage& reply) const
{
return _SendJsonRequest(domain, fCredentials, requestData, requestDataSize,
flags, reply);
}
status_t
WebAppInterface::_SendJsonRequest(const char* domain,
WebAppInterface::_SendJsonRequest(const char* urlPathComponents,
UserCredentials credentials, BPositionIO* requestData,
size_t requestDataSize, uint32 flags, BMessage& reply) const
{
if (requestDataSize == 0) {
HDINFO("jrpc; empty request payload");
HDINFO("%s; empty request payload", PROTOCOL_NAME);
return B_ERROR;
}
if (!ServerHelper::IsNetworkAvailable()) {
HDDEBUG("jrpc; dropping request to ...[%s] as network is not"
" available", domain);
HDDEBUG("%s; dropping request to ...[%s] as network is not"
" available", PROTOCOL_NAME, urlPathComponents);
delete requestData;
return HD_NETWORK_INACCESSIBLE;
}
if (ServerSettings::IsClientTooOld()) {
HDDEBUG("jrpc; dropping request to ...[%s] as client is too old",
domain);
HDDEBUG("%s; dropping request to ...[%s] as client is too old",
PROTOCOL_NAME, urlPathComponents);
delete requestData;
return HD_CLIENT_TOO_OLD;
}
BUrl url = ServerSettings::CreateFullUrl(BString("/__api/v1/") << domain);
HDDEBUG("jrpc; will make request to [%s]", url.UrlString().String());
BUrl url = ServerSettings::CreateFullUrl(BString("/__api/v2/")
<< urlPathComponents);
HDDEBUG("%s; will make request to [%s]", PROTOCOL_NAME,
url.UrlString().String());
// If the request payload is logged then it must be copied to local memory
// from the stream. This then requires that the request data is then
@ -894,7 +795,7 @@ WebAppInterface::_SendJsonRequest(const char* domain,
if (Logger::IsTraceEnabled()) {
HDLOGPREFIX(LOG_LEVEL_TRACE)
printf("jrpc request; ");
printf("%s request; ", PROTOCOL_NAME);
_LogPayload(requestData, requestDataSize);
printf("\n");
}
@ -937,8 +838,8 @@ WebAppInterface::_SendJsonRequest(const char* domain,
int32 statusCode = result.StatusCode();
HDDEBUG("jrpc; did receive http-status [%" B_PRId32 "] from [%s]",
statusCode, url.UrlString().String());
HDDEBUG("%s; did receive http-status [%" B_PRId32 "] from [%s]",
PROTOCOL_NAME, statusCode, url.UrlString().String());
switch (statusCode) {
case B_HTTP_STATUS_OK:
@ -949,8 +850,9 @@ WebAppInterface::_SendJsonRequest(const char* domain,
return HD_CLIENT_TOO_OLD;
default:
HDERROR("jrpc request to endpoint [.../%s] failed with http "
"status [%" B_PRId32 "]\n", domain, statusCode);
HDERROR("%s; request to endpoint [.../%s] failed with http "
"status [%" B_PRId32 "]\n", PROTOCOL_NAME, urlPathComponents,
statusCode);
return B_ERROR;
}
@ -958,7 +860,7 @@ WebAppInterface::_SendJsonRequest(const char* domain,
if (Logger::IsTraceEnabled()) {
HDLOGPREFIX(LOG_LEVEL_TRACE)
printf("jrpc response; ");
printf("%s; response; ", PROTOCOL_NAME);
_LogPayload(&replyData, replyData.BufferLength());
printf("\n");
}
@ -977,15 +879,15 @@ WebAppInterface::_SendJsonRequest(const char* domain,
status_t
WebAppInterface::_SendJsonRequest(const char* domain, const BString& jsonString,
uint32 flags, BMessage& reply) const
WebAppInterface::_SendJsonRequest(const char* urlPathComponents,
const BString& jsonString, uint32 flags, BMessage& reply) const
{
// gets 'adopted' by the subsequent http request.
BMemoryIO* data = new BMemoryIO(jsonString.String(),
jsonString.Length() - 1);
return _SendJsonRequest(domain, data, jsonString.Length() - 1, flags,
reply);
return _SendJsonRequest(urlPathComponents, data, jsonString.Length() - 1,
flags, reply);
}
@ -1034,7 +936,7 @@ WebAppInterface::_LogPayload(BPositionIO* requestData, size_t size)
size = LOG_PAYLOAD_LIMIT;
if (B_OK != requestData->ReadExactly(buffer, size)) {
printf("jrpc; error logging payload");
printf("%s; error logging payload", PROTOCOL_NAME);
} else {
for (uint32 i = 0; i < size; i++) {
bool esc = buffer[i] > 126 ||

View File

@ -140,18 +140,15 @@ private:
status_t _RetrieveUserUsageConditionsCopy(
const BString& code, BDataIO* stream);
void _WriteStandardJsonRpcEnvelopeValues(
BJsonWriter& writer,
const char* methodName);
status_t _SendJsonRequest(const char* domain,
status_t _SendJsonRequest(const char* urlPathComponents,
const BString& jsonString, uint32 flags,
BMessage& reply) const;
status_t _SendJsonRequest(const char* domain,
status_t _SendJsonRequest(const char* urlPathComponents,
UserCredentials credentials,
BPositionIO* requestData,
size_t requestDataSize, uint32 flags,
BMessage& reply) const;
status_t _SendJsonRequest(const char* domain,
status_t _SendJsonRequest(const char* urlPathComponents,
BPositionIO* requestData,
size_t requestDataSize, uint32 flags,
BMessage& reply) const;