Raised This Month: $87 Target: $400
 21% 

[ANY] SteamWorks


Post New Thread Reply   
 
Thread Tools Display Modes
ReymonARG
Junior Member
Join Date: Jun 2017
Old 09-26-2017 , 17:46   Re: [ANY] SteamWorks
Reply With Quote #621

Quote:
Originally Posted by KyleS View Post
Can't you just set the headers?

Yes but how I still connected to the host?
I can't send 70mb file with SteamWorks_SetHTTPRequestRawPostBody at one.

Now i split and send multipart like real multipart will do.

EDIT:
I forgot to post a sample code... now I'm doing a fake multipart (with redis in the server i handle the parts)
the idea is to use the multipart protocol

Code:
#include <sourcemod>
#include <SteamWorks>


public Plugin myinfo = 
{
	name = "MultiPart",
	author = "Ramón Berrutti <Reymon>",
	description = "MultiPart test",
	version = "1.0",
	url = "https://ramonberrutti.com"
};

public void OnPluginStart()
{
	RegServerCmd("multipart_test",    OnConsole_multipart_test,     "Test MultiPart");
}


public Action OnConsole_multipart_test(int args)
{
	File file = OpenFile("ebacon2__round06.txt", "r");

	UploadFile( file );

	return Plugin_Handled;
}

void UploadFile(File file)
{

	if( file.EndOfFile() )
	{
		file.Close();
		return;
	}


	char buffer[1024];
	if(!file.EndOfFile() && file.ReadString(buffer, sizeof(buffer)))
    {
		Handle req = SteamWorks_CreateHTTPRequest( k_EHTTPMethodPOST, "http://localhost:3000/api/backups");
		SteamWorks_SetHTTPCallbacks(req, RequestCallback);

		SteamWorks_SetHTTPRequestContextValue(req, file);

		char buffer2[2048];
		FormatEx(buffer2, sizeof(buffer2), "--%s\r\nContent-Disposition: form-data; name=\"file\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\n\r\n%s", "AaB03x", buffer);

		// If file finish add the finish part
		/*if( file.EndOfFile() )
		{
			Format(buffer2, sizeof(buffer2), "%s\r\n--%s--", buffer2, "AaB03x");
		}*/

		Format(buffer2, sizeof(buffer2), "%s\r\n--%s--", buffer2, "AaB03x");

		PrintToServer("New Part Size:%i -->\n%s", strlen(buffer2), buffer2);

		SteamWorks_SetHTTPRequestRawPostBody(req, "multipart/form-data; boundary=AaB03x", buffer2, strlen(buffer2));
		SteamWorks_SendHTTPRequest(req);
    }
}


public int RequestCallback(Handle request, bool failure, bool requestSuccessful, EHTTPStatusCode statusCode, File file) 
{
	//PrintToServer("%i) Failure: %i RquestSuccessful: %i Status: %i", count, failure, requestSuccessful, statusCode);

	if( requestSuccessful && statusCode == k_EHTTPStatusCode200OK )
	{
		UploadFile(file);
	}
}

Last edited by ReymonARG; 09-26-2017 at 18:52.
ReymonARG is offline
stickz
Senior Member
Join Date: Oct 2012
Location: Ontario, Canada
Old 10-16-2017 , 14:47   Re: [ANY] SteamWorks
Reply With Quote #622

I just crashed my game-server with this extension.
https://crash.limetech.org/4bn2qkvblmcg

I updated to the latest version while it was running, then it crashed when the map changed.
stickz is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 10-16-2017 , 15:05   Re: [ANY] SteamWorks
Reply With Quote #623

Quote:
Originally Posted by stickz View Post
I updated to the latest version while it was running, then it crashed when the map changed.
What exactly did you expect to happen? It isn't safe to replace binaries while the server is running.
__________________
asherkin is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 10-16-2017 , 16:12   Re: [ANY] SteamWorks
Reply With Quote #624

Quote:
Originally Posted by stickz View Post
I just crashed my game-server with this extension.
https://crash.limetech.org/4bn2qkvblmcg

I updated to the latest version while it was running, then it crashed when the map changed.
This command exists exactly to help prevent that: https://linux.die.net/man/1/install
KyleS is offline
Gamebiter
New Member
Join Date: Oct 2017
Old 10-27-2017 , 11:29   Re: [ANY] SteamWorks
Reply With Quote #625

I have a server i need SteamWorks on, How do i download it and install it? Please help a noobish server runner!
Gamebiter is offline
Gamebiter
New Member
Join Date: Oct 2017
Old 10-27-2017 , 11:40   Re: [ANY] SteamWorks
Reply With Quote #626

trying to add SA3 to my server..
I get this "Console:
"Oct 27 16:08:14: L 10/27/2017 - 14:08:14: [SM] Exception reported: [SA3] SteamWorks is not loaded
Oct 27 16:08:14: L 10/27/2017 - 14:08:14: [SM] Blaming: ServerAdvertisements3.smx
Oct 27 16:08:14: L 10/27/2017 - 14:08:14: [SM] Call stack trace:
Oct 27 16:08:14: L 10/27/2017 - 14:08:14: [SM] [0] SetFailState
Oct 27 16:08:14: L 10/27/2017 - 14:08:14: [SM] [1] Line 67, D:\Sourcemod\ServerAdvertisements3\ServerAdve rtisements3.sp::OnMapStart""
Gamebiter is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 10-31-2017 , 19:06   Re: [ANY] SteamWorks
Reply With Quote #627

Quote:
Originally Posted by Gamebiter View Post
I have a server i need SteamWorks on, How do i download it and install it? Please help a noobish server runner!
Drop the .dll or .so into your extensions folder, that's it.
KyleS is offline
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old Yesterday , 19:04   Re: [ANY] SteamWorks
Reply With Quote #628

I'm using the SteamWorks extension in the following plugin: https://github.com/Sarabveer/SM-Plug...sc_override.sp

Just that the plugin is not working, there is no plugin error in the server error log, I contacted the creator of the plugin and he said that the problem will be with SteamWorks.

What could it be, how can I correct it?

[EDIT]
Game: Counter-Strike: Global Offensive
__________________
ABOUT-ME
Owner ZK Corporation
Owner ZK Servidores


Last edited by paulo_crash; Today at 17:38.
paulo_crash is offline
Send a message via Skype™ to paulo_crash
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old Yesterday , 21:36   Re: [ANY] SteamWorks
Reply With Quote #629

Quote:
Originally Posted by paulo_crash View Post
I'm using the SteamWorks extension in the following plugin: https://github.com/Sarabveer/SM-Plug...sc_override.sp

Just that the plugin is not working, there is no plugin error in the server error log, I contacted the creator of the plugin and he said that the problem will be with SteamWorks.

What could it be, how can I correct it?
What game?
KyleS is offline
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old Today , 17:37   Re: [ANY] SteamWorks
Reply With Quote #630

Quote:
Originally Posted by KyleS View Post
What game?
It would be Counter-Strike: Global Offensive (CSGO)
__________________
ABOUT-ME
Owner ZK Corporation
Owner ZK Servidores

paulo_crash is offline
Send a message via Skype™ to paulo_crash
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:58.


Powered by vBulletin®
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Theme made by Freecode