Page MenuHomeFeedback Tracker

RestCallback::OnSuccess invokes with PUT reqest data if web server has empty response
Closed, ResolvedPublic

Description

If a RestContext::PUT call is made with a body data string and the webserver responds with OK 200 but empty response body the callback seems to be re-using the PUT data buffer instead and it appears like the webserver echoed the original request - even though that is not the case. I guess after sending the PUT the buffer must be cleared even if the response is empty?

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General

Event Timeline

Arkensor created this task.Jun 3 2023, 10:53 AM
Geez changed the task status from New to Assigned.Jun 6 2023, 2:44 PM
Geez changed the task status from Assigned to Reviewed.Jun 6 2023, 4:33 PM
Geez added a subscriber: Geez.

Hello Arkensor.
This info comes from the responsible developer:

  • it's actually status messsage because data are not present
  • however it does not make sense anyway - so status will be not returned in such case (to not be considered as data by anyone), but empty string instead

Also if possible, please attach logs and data in the future tickets as it makes harder for the devs to assume what you are trying to describe

Arkensor added a comment.EditedJun 6 2023, 4:40 PM

Hello,

I am sorry if my bug report was not clear enough. I thought I had given all the required info to reproduce. I make so many tickets here each week that sometimes I don't have time to provide a full reproduction. However here it is ready to copy paste

class TestWebCallback : RestCallback
{
	static ref set<ref TestWebCallback> s_aSelfReferences = new set<ref TestWebCallback>();

	static TestWebCallback PostToUrl(string url, string data)
	{
		TestWebCallback callback();
		s_aSelfReferences.Insert(callback);
		RestContext context = GetGame().GetRestApi().GetContext(url);
		context.POST(callback, "", data);
		return callback;
	}

	override void OnError(int errorCode)
	{
		s_aSelfReferences.RemoveItem(this);
		Print(" !!! OnError() ");
	};

	override void OnTimeout()
	{
		s_aSelfReferences.RemoveItem(this);
		Print(" !!! OnTimeout() ");
	};

	override void OnSuccess(string data, int dataSize)
	{
		s_aSelfReferences.RemoveItem(this);
		Print(" !!! OnSuccess() size=" + dataSize );
		if (dataSize > 0)
			Print(data);
	};
};

TestWebCallback.PostToUrl("https://webhook.site/640403f4-c83e-4977-aac7-ef863a6c69da", "I like Arma!!!");

SCRIPT : !!! OnSuccess() size=14
SCRIPT : string data = 'I like Arma!!!'

While the website is configured to return NOTHING. You can check by opening the link direclty.

Sanity checking with postman shows that webhook.site does not echo by default or anything. Just empty response body. And that triggers the problem, both with POST and PUT and maybe anything that sends a request body?

Geez added a comment.Jun 6 2023, 4:49 PM

forwarded :)

Geez added a comment.Jun 6 2023, 4:52 PM

Apologies from the dev, I was given a wrong ticket, the original response was supposed to go to https://feedback.bistudio.com/T166390

Geez added a comment.Jun 6 2023, 4:57 PM

and the info from this ticket will be ofcourse looked at

Geez closed this task as Resolved.Jun 9 2023, 11:05 AM
Geez claimed this task.

Hello Arkensor.
The problem has been addressed internally and the fix will appear in one of the future updates.