Raised This Month: $12 Target: $400
 3% 

[EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system natives


Post New Thread Reply   
 
Thread Tools Display Modes
T1MOXA
Member
Join Date: Aug 2016
Old 07-24-2018 , 10:17   Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
Reply With Quote #101

Yes, I know that 7z didn't you.
But unfortunately I did not find a solution to my problem in the network, so I decided to ask you.
Yes, I wrote the plugin for myself.
I'll try a lower compression level.
T1MOXA is offline
694372459
Member
Join Date: Aug 2012
Old 09-08-2018 , 12:20   Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
Reply With Quote #102

Hi, I've tested FTP download feature, after finish the downloaded file is 0kb (empty), can you check it?

P.S the legacy ftp download native works fine

Last edited by 694372459; 09-08-2018 at 12:21.
694372459 is offline
dordnung
Veteran Member
Join Date: Apr 2010
Old 09-21-2018 , 06:28   Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
Reply With Quote #103

Hey,
can you show me the part of your code, as it works fine for me?
__________________
dordnung is offline
694372459
Member
Join Date: Aug 2012
Old 12-05-2018 , 01:31   Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
Reply With Quote #104

Quote:
Originally Posted by dordnung View Post
Hey,
can you show me the part of your code, as it works fine for me?
Hi, thanks for replying

here's my code:

PHP Code:
#include <sourcemod>
#include <system2>

#define FTP_HOST ""
#define FTP_PORT
#define FTP_USER ""
#define FTP_PWD ""
#define FTP_REQUEST_FILE ""

public OnPluginStart()
{
    
RegServerCmd("test_ftp_download"Command_TestDownload);
}

public 
Action:Command_TestDownload(args)
{
    
System2FTPRequest ftpRequest = new System2FTPRequest(FtpResponseCallbackFTP_REQUEST_FILE);
    
ftpRequest.SetAuthentication(FTP_USERFTP_PWD);
    
ftpRequest.SetPort(FTP_PORT);
    
ftpRequest.SetOutputFile("addons/sourcemod/data/test_ftp_download.txt");
    
ftpRequest.StartRequest(); 
    
delete ftpRequest;
    
    return 
Plugin_Handled;
}

public 
void FtpResponseCallback(bool success, const char[] errorSystem2FTPRequest requestSystem2FTPResponse response) {
    if (
success) {
        
char file[PLATFORM_MAX_PATH];
        
request.GetInputFile(filesizeof(file));

        if (
strlen(file) > 0) {
            
PrintToServer("Download Finished");    
        }
    }

694372459 is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 12-05-2018 , 06:34   Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
Reply With Quote #105

Quote:
Originally Posted by 694372459 View Post
Hi, thanks for replying

here's my code:

PHP Code:
#include <sourcemod>
#include <system2>

#define FTP_HOST ""
#define FTP_PORT
#define FTP_USER ""
#define FTP_PWD ""
#define FTP_REQUEST_FILE ""

public OnPluginStart()
{
    
RegServerCmd("test_ftp_download"Command_TestDownload);
}

public 
Action:Command_TestDownload(args)
{
    
System2FTPRequest ftpRequest = new System2FTPRequest(FtpResponseCallbackFTP_REQUEST_FILE);
    
ftpRequest.SetAuthentication(FTP_USERFTP_PWD);
    
ftpRequest.SetPort(FTP_PORT);
    
ftpRequest.SetOutputFile("addons/sourcemod/data/test_ftp_download.txt");
    
ftpRequest.StartRequest(); 
    
delete ftpRequest;
    
    return 
Plugin_Handled;
}

public 
void FtpResponseCallback(bool success, const char[] errorSystem2FTPRequest requestSystem2FTPResponse response) {
    if (
success) {
        
char file[PLATFORM_MAX_PATH];
        
request.GetInputFile(filesizeof(file));

        if (
strlen(file) > 0) {
            
PrintToServer("Download Finished");    
        }
    }

Shouldn't you close (delete) the FTP request handle (only) in the callback?

Also avoid mixing old and new syntax
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 12-05-2018 at 06:35.
Papero is offline
dordnung
Veteran Member
Join Date: Apr 2010
Old 12-06-2018 , 12:23   Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
Reply With Quote #106

Quote:
Shouldn't you close (delete) the FTP request handle (only) in the callback?
No it should not be deleted in the callback, as a copy is used there which will be deleted automatically after the callback. It should be deleted after making a request or when not used anymore.

Thanks for reporting it, I found the problem. I've forgot to close the file after downloading, thats why it was empty. This is fixed now.
But the "GetInputFile" part does not make sense. The input file is only set when uploading stuff to a FTP server.

Update to System2 v3.2.1

- Automatically use 32-Bit 7-ZIP when 64-Bit is not executable
- Fix incomplete file when downloading files with FTP
- Added libcurl certificate file for SSL instead of using system's certificate file
- Updated to the latest libcurl version
__________________

Last edited by dordnung; 12-06-2018 at 12:25.
dordnung is offline
T1MOXA
Member
Join Date: Aug 2016
Old 03-31-2019 , 19:10   Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
Reply With Quote #107

For some reason, files are not always archived on the same server, there are no problems with manual compression.
How to understand the cause of the error ?
T1MOXA is offline
NanoC
Veteran Member
Join Date: Jan 2016
Location: Argentina
Old 04-06-2019 , 02:58   Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
Reply With Quote #108

Quote:
Originally Posted by T1MOXA View Post
For some reason, files are not always archived on the same server, there are no problems with manual compression.
How to understand the cause of the error ?
something like this?
https://github.com/dordnung/System2/issues/9
__________________
NanoC is offline
Send a message via Skype™ to NanoC
ph
AlliedModders Donor
Join Date: Mar 2006
Old 10-25-2019 , 07:42   Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
Reply With Quote #109

Quote:
Originally Posted by nomy View Post
[SM] Unable to load extension "system2.ext": Could not find interface: IPluginManager

Game: CS:S

Can this be fixed?

TF2
__________________
ph is offline
TandelK
Member
Join Date: Jun 2015
Location: Surat, India
Old 05-04-2020 , 05:20   Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
Reply With Quote #110

How do we use Passive FTP Method with this plugin ? I have unlimited Web Hosting and they are using Passive FTP Hosting and i tried it using a plugin via FTP directly but it seems it is not working properly. I am trying to upload Demos after matches are completed.
__________________
TandelK is offline
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 18:10.


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