AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system natives (https://forums.alliedmods.net/showthread.php?t=146019)

T1MOXA 07-24-2018 10:17

Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
 
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.

694372459 09-08-2018 12:20

Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
 
Hi, I've tested FTP download feature, after finish the downloaded file is 0kb (empty), can you check it? :3

P.S the legacy ftp download native works fine

dordnung 09-21-2018 06:28

Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
 
Hey,
can you show me the part of your code, as it works fine for me?

694372459 12-05-2018 01:31

Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
 
Quote:

Originally Posted by dordnung (Post 2616144)
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");    
        }
    }



Papero 12-05-2018 06:34

Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
 
Quote:

Originally Posted by 694372459 (Post 2626827)
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

dordnung 12-06-2018 12:23

Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
 
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

T1MOXA 03-31-2019 19:10

Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
 
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 ?

NanoC 04-06-2019 02:58

Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
 
Quote:

Originally Posted by T1MOXA (Post 2645756)
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

ph 10-25-2019 07:42

Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
 
Quote:

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

Game: CS:S


Can this be fixed?

TF2

TandelK 05-04-2020 05:20

Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
 
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.


All times are GMT -4. The time now is 02:54.

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