playnet-public / arma3urlfetch Goto Github PK
View Code? Open in Web Editor NEWA OpenSource ArmA 3 URL fetching extension tool
License: MIT License
A OpenSource ArmA 3 URL fetching extension tool
License: MIT License
Hi Vincent,
first of all i really like the approach to use a http client to send my data to my backend instead of using extdb to connect my database directly.
Right now i try to send some data to my backend but i am very new to SQF and i cant find a documentation how to make a manual post request to my backend. Maybe you have some advice what i am doing wrong here.
while {true} do {
_serverName = serverName;
_worldName = worldName;
_justPlayers = allPlayers - entities "HeadlessClient_F";
{
_player = _x;
_name = name _player;
_uid = getPlayerUID _player;
_uidParameter = format ["ping[arma_id]=%1", _uid];
[
"FUNC",
[
"#url=https://x.x.royal-combat-force.de/x",
"#method=POST",
"#postData", _uidParameter
]
] callExtensions "arma3urlfetch";
} forEach _justPlayers;
Sleep 15;
};
I want to send the player id to my backend as post, i always get an error that i am missing a ; near /ping (which is part of the URL. Maybe you can post a example for making a manual post request :)
From the RPT
23:56:16 Error in expression <d=POST",
"#postData", _uidParameter
]
] callExtensions "arma3urlfetch";
} forEa>
23:56:16 Error position: <callExtensions "arma3urlfetch";
} forEa>
23:56:16 Error Missing ;
23:56:16 File rcf_custom\stats\pingpong.sqf, line 23
23:56:16 Error in expression <d=POST",
"#postData", _uidParameter
]
] callExtensions "arma3urlfetch";
} forEa>
23:56:16 Error position: <callExtensions "arma3urlfetch";
} forEa>
23:56:16 Error Missing ;
Greetings and thanks for the support,
Stefan
Reproducing steps:
[] spawn { hint str (["https://httpbin.org/get", "GET", ["sexy=ss3"], true] call a3uf_common_fnc_request); };
The following format for results are:
Running System: Windows/Linux 32-/64-bit
First run successful: yes/no
Second run successful: yes/no
Error log: (as attachment; logs are saved (on windows) in%localappdata%\Arma 3
)
I appreciate your help!
Sincerely
-Vincent
Hi
First of thanks for urlfetch, works greate.
Curl don't send an HTTP_USER_AGENT string
this is normal best practice to send an HTTP_USER_AGENT with an program identificer.
If you add HTTP_USER_AGENT could you also add OS info, like linux/windows and version :)
would help but my c++ knowledge is not there yet
Any chance for an 64bit Linux version ?
On vanilla installations of Windows 10 and Server 2016 there is no VC++ 2015 redist package installed therefor the dll can not be loaded and calling the extension fails with an error in the .rpt file.
This is due the compilation of CURL with VC++ 2015 which links against MSVCP140.dll
The extension should now be compiled by the VC12 compiler.
Would you like to re-check the extension again? (Just use one of the artifacts of the latest commit(s))
The libssl
and libcrypto
libraries shall be build manually because otherwise they do not support different Linux distributions.
Currently, builds of this project have to be separated by their distributions (focused on Debian and Ubuntu).
This version description describes that the built DLLs as being whitelisted by Battleye. However, Battleye will block the extensions whenever they are called.
As i progress, using the Addon to establish an authorization workflow, i now stumbled across the following error:
"0xC0000409 - STATUS_STACK_BUFFER_OVERRUN".
Here's my request:
_cliendid = ["http://192.168.0.102:8000/api/user", "GET", [], true] call a3uf_common_fnc_addClient;
access_token = "7c9f8d58da05147b9cfe0bfb9210603668c924bc";
_token_string = format ["Bearer %1", access_token];
[_cliendid, [["Content-Type", "application/json"], ["Authorization", _token_string]]] call a3uf_common_fnc_setClientHeaders;
_response = [_cliendid] call a3uf_common_fnc_clientRequest;
Its a function, spawned by user input, which calls a local api endpoint, maybe its just a headers problem.
Thanks in advance,
Luke
i want to use this mods in linux server i love it but linux don't support dll file
is there anyway to use with linux?
Because testing on a local machine is not that efficent, we should add CI support to this repository.
First, we have to accomplish #16 to add that CI support.
After that, we have to create both windows and linux CI's because this modification uses both operating systems.
We also have to find a provider who hosts Windows servers and/or containers -> Open to discuss.
In case of a client-side deployment, this parameter prohibits security through obscurity.
Affected are for example API tokens.
Basically everything a client would need, but shouldn't see or know himself that gets send to or through the extension.
Sincerely Rage
We need a makefile to easily build this modification on multiple different operating systems.
Moreover, we have to automize the process of building and including static libcurl
and libssh
libraries.
21:07:28 ["",601,0]
21:07:28 ["",600,0]
21:07:28 ["",600,0]
21:07:28 ["",600,0]
21:07:28 ["",600,0]
21:07:28 ["",600,0]
21:07:28 ["",600,0]
21:07:28 ["",600,0]
21:07:29 ["",600,0]
21:07:29 ["",600,0]
21:07:29 ["",600,0]
This is a result of GETRQ
code snippet in a cycle. Previous versions were reporting 602
code as intended to be that extension still going on with SENDRQ
. Now it instantly falls to 601
which is failed
.
Mistake? Thanks.
We need to add an optional parameter to allow automatic curl redirects.
The keyword name will be #redirect
.
It will just enable HTTP redirects from the server.
Ist das egal
vereinfacht sich das Parsen von Daten innerhalb der Extension immens.
Der eigentliche Call wird etwas verständlicher.
Die Extension kann einen eigenen Fehler -Code zurück geben.
Debugging in Arma und stati der Extension können dadurch verbessert werden.
Gruß Rage
~
~Ask for Muzzleflash's JSON decoding script
https://forums.bistudio.com/forums/topic/162724-json-parser-in-and-for-sqf/
This is likely linked to #36 , whenever our webservice is unreachable or has a timeout for whatever reason the entire game server crashes. Is there any workaround to use?
we are calling it like this within a spawned function:
private _response = [
format ["https://***%1", _endpoint],
_method,
["Content-Type", "application/json", "X-Remove-Null", "true", "Authorization", "Bearer ***"],
_data,
true
] call a3uf_common_fnc_request;
you are wrong lol for once i can say that :p
https://i.imgur.com/eyBZMWJ.png
link to screenshot
https://dev.arma3.com/post/spotrep-00095
Or goto
https://www.pcgamer.com/uk/after-seven-years-arma-3-hits-v20/
And
CTRL + F
Added: 64-bit Linux Dedicated Server
Originally posted by @Ni1kko in #33 (comment)
~
Currently there is no functionality to add body contents like application/text
or application/json
.
We should add this to increase the functionality of this HTTP client.
The functionality is identical to the current way of setting client parameters or headers.
Roadmap:
fn_setClientBody.sqf
SETCLIB
SETCLIP
or SETCLIH
For the future, we've got an idea of (again) new system, which is eventually the final system:
For example, a new object client
is defined.
This client
contains information about a default request
. Those information could be the URL, the header or the method and so on.
Thus, you use your predefined client to request an URL. When you request the information saved by the client, you can also overwrite the default parameters given.
In the end it should be an more object oriented way than now.
-Vincent
We have to add a set and receive function for using cookies.
~
Hi there, we've encountered a lot of reports that extension fails to load on Linux version of dedicated server. Reports origin from Ubuntu 16.04, Debian 9.5.0 and sometimes other linux systems. We've checked that ldd reports all dependencies to be in place on the same OS.
Might it be so some of the libs doesn't support specific OS, and if they do - what types of OS are currently 100% supported?
Thanks.
In title.
There have to be a functionality to receive more than 10240 as input.
Well we can not change the ArmA 3 extension input limitation, but we can remove each time we call GETRQ
a part of the byte size 10240 from the result string Requests::Result
.
In a return codes page it was stated that those commands handle HTTP codes (>100). But I seem to be recieving only 0 and 1, which is done and pending custom codes from extension. How to handle something like 200, 404 or 502 for example?
Thanks.
EDIT: Also all of those commands support HTTP codes >100?
Windows servers running DLL with no players are experiencing some huge CPU loads (~30-40% average). This was tested on both desktop and server type of CPU's (i7-7700K and Xeon E5 1650-v4) but both servers were running Windows 2016 Standart. There are nothing else in common but 2016 OS, so that might be an issue source. Servers do not experience any load without DLL used.
Thanks.
We met some reports with SENDRQ
returning 500
code on first try, which tells that server is unable to process the condition. We did an experiment and used old version (1.0) of A3UF and it succeeded with the same conditions. It's a paradox, since tests shown that client and server confirmed not to be a source of a problem. Might that be a code exception related to 1.1 update in windows version?
Thanks.
Hi
Is there an easy way to use headers with a3uf_common_fnc_request
Our api uses an auth token in the header for validation and it would help for simplicity
in the sqf code if we could use a3uf_common_fnc_request
instead of a3uf_common_fnc_setClientHeaders
/a3uf_common_fnc_clientRequest
Like so
private _response = [
<string/url>, //the url of an request
<string/method>, //the HTTP method; most of the time it is "GET"
<array/params>, //(optional) parameters of the url request
<array/headers>, //(optional) headers of the url request
<bool/decodeJson> //(optional) should a json response converted?
] call a3uf_common_fnc_request;
The STAT
and RECV
section has a problem with checking the correct value. There is a error free char* to int conversion needed.
POST data is a very important feature to add because it is used in web applications literally every time.
#postData
#postData
can be inserted multiple times in a request and unlimited arguments can be passed to #postData
passiert vollends in Arma.
Funktionieren tut das mit Sicherheit gut, Performance ist allerdings fragwürdig.
Seit einiger Zeit gibt es den Befehl
ParseSimpleArray
Der mehrdimensionale Arrays aus einem String Parsen kann.
M.m nach ist das der aktuellen SQF Implementierung vor zu ziehen.
Vorallem weil JSON Arrays identisch zu Arma Arrays sind.
Gruß Rage
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.