Page MenuHomeFeedback Tracker

Crash when using new Curl API for file
Reviewed, NormalPublic

Description

Currently have a problem with the new API file with Curl, everytime trying to create a file at client side, it's crashing the game.

You can get the content of the file with the link : https://la-quarantaine.fr/uploads/affiches/test.txt
The only way it's worked, was at server side with a callback class.

The rpt shows fine, the Curl has been a success

[CURL DEBUG] ID:[1] (success, data size=10, age=156 ms) :: GET=https://la-quarantaine.fr/uploads/affiches/test.txt

but it's crashing right after this print into the rpt.

Our goal is mainly to download images, if you want to test with images, we have a link here : https://la-quarantaine.fr/uploads/affiches/affiche_9a4464c17d37d8c9463b822f191b18ee.jpeg

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Modding
Steps To Reproduce
m_CURLCore = CreateCURLCore();
m_CURLContext = m_CURLCore.GetCURLContext("https://la-quarantaine.fr/uploads/affiches/");
m_CURLContext.FILE_now("test.txt", "test.txt") // or m_CURLContext.FILE(new CURLGetPosterCB(), "test.txt", "test.txt"), CURLGetPosterCB being a copy/pasta from base CallBack class

Event Timeline

NiiRoZz created this task.Jan 29 2020, 10:53 PM

Client-side crash logs

Server-side crash logs (does not crash when using a CallBack, only with FILE_now

Also, images are saved in "ServerProfile\Users\Survivor" and trying to save with "$profile:file.txt" will result in having a file named "$profile" in "ServerProfile\Users\Survivor".

Geez changed the task status from New to Assigned.Jan 30 2020, 10:33 AM
Geez changed the task status from Assigned to Reviewed.Jan 30 2020, 11:36 AM
Geez added a subscriber: Geez.

Hello NiiRoZz and thank you for the report.

The Issue is that this function does require Hive ATM to be initialized prior to CURL usage.
For now, just enable minimal Hive (can be offline) functionality in your mission with almost zero setup.
Comm itself works, i've tested your specific data and successfuly stored those.

Hive ce = CreateHive();
  if ( ce )
      ce.InitSandbox();

For release, report message + fix for the crash will be added.
Not sure if it will work without Hive in the future, we'll see about that.
Also noticed you are forgetting semicolon at "m_CURLContext.FILE_now("test.txt", "test.txt") ".
Small hint about "m_CURLCore = CreateCURLCore();" - this is a bit redundant, Core class is sole - so it just copy
pointer into slower script var - GetCURLCore() is sufficient.

Thanks for a good catch.

Regards,
Geez

Hello, thanks for the reply.

This is really annoying to need Hive. Especially when you want to get information at clientside when you are on a server. More than 75% of the use case is in this case. This would be awesome to not need the Hive.

But thanks for the fix and the message logged.

Regards,
NiiRoZz

Thank you Geez.

I just tried the new update. Everything work as intended server-side. However, we can't save anywhere else than the default location in ServerProfile\Users\Survivor.
Also, it does not work at all client side. I don't know if it's related, but my test is in an action, and when I try to FILE or FILE_NOW inside it, my game just is in a weird state where no action show up, and nothing is printed anywhere (script/crash/RPT).

Regards,