mirror of
https://codeberg.org/demostf/plugin.git
synced 2026-06-04 00:54:08 +02:00
commit
1e954c79a0
4 changed files with 87 additions and 84 deletions
BIN
demostf.smx
BIN
demostf.smx
Binary file not shown.
89
demostf.sp
89
demostf.sp
|
|
@ -1,8 +1,9 @@
|
||||||
#pragma semicolon 1
|
#pragma semicolon 1
|
||||||
|
#pragma newdecls required
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
#include <cURL>
|
#include <cURL>
|
||||||
|
|
||||||
public Plugin:myinfo =
|
public Plugin myinfo =
|
||||||
{
|
{
|
||||||
name = "demos.tf uploader",
|
name = "demos.tf uploader",
|
||||||
author = "Icewind",
|
author = "Icewind",
|
||||||
|
|
@ -11,45 +12,46 @@ public Plugin:myinfo =
|
||||||
url = "https://demos.tf"
|
url = "https://demos.tf"
|
||||||
};
|
};
|
||||||
|
|
||||||
new CURL_Default_opt[][2] = {
|
int CURL_Default_opt[][2] = {
|
||||||
{_:CURLOPT_NOSIGNAL,1},
|
{ view_as<int>(CURLOPT_NOSIGNAL), 1 },
|
||||||
{_:CURLOPT_NOPROGRESS,1},
|
{ view_as<int>(CURLOPT_NOPROGRESS), 1 },
|
||||||
{_:CURLOPT_TIMEOUT,600},
|
{ view_as<int>(CURLOPT_TIMEOUT), 600 },
|
||||||
{_:CURLOPT_CONNECTTIMEOUT,600},
|
{ view_as<int>(CURLOPT_CONNECTTIMEOUT), 600 },
|
||||||
{_:CURLOPT_USE_SSL,CURLUSESSL_TRY},
|
{ view_as<int>(CURLOPT_USE_SSL), CURLUSESSL_TRY },
|
||||||
{_:CURLOPT_SSL_VERIFYPEER,0},
|
{ view_as<int>(CURLOPT_SSL_VERIFYPEER), 0 },
|
||||||
{_:CURLOPT_SSL_VERIFYHOST,0},
|
{ view_as<int>(CURLOPT_SSL_VERIFYHOST), 0 },
|
||||||
{_:CURLOPT_VERBOSE,0}
|
{ view_as<int>(CURLOPT_VERBOSE), 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a string to lowercase
|
* Converts a string to lowercase
|
||||||
*
|
*
|
||||||
* @param buffer String to convert
|
* @param buffer String to convert
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
public CStrToLower(String:buffer[]) {
|
public void CStrToLower(char[] buffer) {
|
||||||
new len = strlen(buffer);
|
int len = strlen(buffer);
|
||||||
for(new i = 0; i < len; i++) {
|
for(int i = 0; i < len; i++) {
|
||||||
buffer[i] = CharToLower(buffer[i]);
|
buffer[i] = CharToLower(buffer[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CURL_DEFAULT_OPT(%1) curl_easy_setopt_int_array(%1, CURL_Default_opt, sizeof(CURL_Default_opt))
|
#define CURL_DEFAULT_OPT(%1) curl_easy_setopt_int_array(%1, CURL_Default_opt, sizeof(CURL_Default_opt))
|
||||||
|
|
||||||
new String:g_sDemoName[256] = "";
|
char g_sDemoName[256] = "";
|
||||||
new String:g_sLastDemoName[256] = "";
|
char g_sLastDemoName[256] = "";
|
||||||
|
|
||||||
new Handle:g_hCvarAPIKey = INVALID_HANDLE;
|
Handle g_hCvarAPIKey = INVALID_HANDLE;
|
||||||
new Handle:g_hCvarUrl = INVALID_HANDLE;
|
Handle g_hCvarUrl = INVALID_HANDLE;
|
||||||
new Handle:output_file = INVALID_HANDLE;
|
Handle output_file = INVALID_HANDLE;
|
||||||
new Handle:postForm = INVALID_HANDLE;
|
Handle postForm = INVALID_HANDLE;
|
||||||
new Handle:g_hCvarRedTeamName = INVALID_HANDLE;
|
Handle g_hCvarRedTeamName = INVALID_HANDLE;
|
||||||
new Handle:g_hCvarBlueTeamName = INVALID_HANDLE;
|
Handle g_hCvarBlueTeamName = INVALID_HANDLE;
|
||||||
|
|
||||||
new Handle:g_hDemoUploaded = INVALID_HANDLE;
|
Handle g_hDemoUploaded = INVALID_HANDLE;
|
||||||
|
|
||||||
public OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
g_hCvarAPIKey = CreateConVar("sm_demostf_apikey", "", "API key for demos.tf", FCVAR_PROTECTED);
|
g_hCvarAPIKey = CreateConVar("sm_demostf_apikey", "", "API key for demos.tf", FCVAR_PROTECTED);
|
||||||
g_hCvarUrl = CreateConVar("sm_demostf_url", "https://demos.tf", "demos.tf url", FCVAR_PROTECTED);
|
g_hCvarUrl = CreateConVar("sm_demostf_url", "https://demos.tf", "demos.tf url", FCVAR_PROTECTED);
|
||||||
|
|
@ -62,12 +64,12 @@ public OnPluginStart()
|
||||||
RegServerCmd("tv_stoprecord", Command_StopRecord);
|
RegServerCmd("tv_stoprecord", Command_StopRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnPluginEnd()
|
public void OnPluginEnd()
|
||||||
{
|
{
|
||||||
CloseHandle(g_hDemoUploaded);
|
CloseHandle(g_hDemoUploaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action:Command_StartRecord(args)
|
public Action Command_StartRecord(int args)
|
||||||
{
|
{
|
||||||
if (strlen(g_sDemoName) == 0) {
|
if (strlen(g_sDemoName) == 0) {
|
||||||
GetCmdArgString(g_sDemoName, sizeof(g_sDemoName));
|
GetCmdArgString(g_sDemoName, sizeof(g_sDemoName));
|
||||||
|
|
@ -77,7 +79,7 @@ public Action:Command_StartRecord(args)
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action:Command_StopRecord(args)
|
public Action Command_StopRecord(int args)
|
||||||
{
|
{
|
||||||
TrimString(g_sDemoName);
|
TrimString(g_sDemoName);
|
||||||
if (strlen(g_sDemoName) != 0) {
|
if (strlen(g_sDemoName) != 0) {
|
||||||
|
|
@ -89,26 +91,27 @@ public Action:Command_StopRecord(args)
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action:StartDemoUpload(Handle:timer)
|
public Action StartDemoUpload(Handle timer)
|
||||||
{
|
{
|
||||||
decl String:fullPath[128];
|
char fullPath[128];
|
||||||
Format(fullPath, sizeof(fullPath), "%s.dem", g_sLastDemoName);
|
Format(fullPath, sizeof(fullPath), "%s.dem", g_sLastDemoName);
|
||||||
UploadDemo(fullPath);
|
UploadDemo(fullPath);
|
||||||
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
UploadDemo(const String:fullPath[])
|
void UploadDemo(const char[] fullPath)
|
||||||
{
|
{
|
||||||
decl String:APIKey[128];
|
char APIKey[128];
|
||||||
GetConVarString(g_hCvarAPIKey, APIKey, sizeof(APIKey));
|
GetConVarString(g_hCvarAPIKey, APIKey, sizeof(APIKey));
|
||||||
decl String:BaseUrl[64];
|
char BaseUrl[64];
|
||||||
GetConVarString(g_hCvarUrl, BaseUrl, sizeof(BaseUrl));
|
GetConVarString(g_hCvarUrl, BaseUrl, sizeof(BaseUrl));
|
||||||
new String:Map[64];
|
char Map[64];
|
||||||
GetCurrentMap(Map, sizeof(Map));
|
GetCurrentMap(Map, sizeof(Map));
|
||||||
PrintToChatAll("[demos.tf]: Uploading demo %s", fullPath);
|
PrintToChatAll("[demos.tf]: Uploading demo %s", fullPath);
|
||||||
new Handle:curl = curl_easy_init();
|
Handle curl = curl_easy_init();
|
||||||
CURL_DEFAULT_OPT(curl);
|
CURL_DEFAULT_OPT(curl);
|
||||||
decl String:bluname[128];
|
char bluname[128];
|
||||||
decl String:redname[128];
|
char redname[128];
|
||||||
GetConVarString(g_hCvarRedTeamName, redname, sizeof(redname));
|
GetConVarString(g_hCvarRedTeamName, redname, sizeof(redname));
|
||||||
GetConVarString(g_hCvarBlueTeamName, bluname, sizeof(bluname));
|
GetConVarString(g_hCvarBlueTeamName, bluname, sizeof(bluname));
|
||||||
|
|
||||||
|
|
@ -122,17 +125,17 @@ UploadDemo(const String:fullPath[])
|
||||||
|
|
||||||
output_file = curl_OpenFile("output_demo.json", "w");
|
output_file = curl_OpenFile("output_demo.json", "w");
|
||||||
curl_easy_setopt_handle(curl, CURLOPT_WRITEDATA, output_file);
|
curl_easy_setopt_handle(curl, CURLOPT_WRITEDATA, output_file);
|
||||||
decl String:fullUrl[128];
|
char fullUrl[128];
|
||||||
Format(fullUrl, sizeof(fullUrl), "%s/upload", BaseUrl);
|
Format(fullUrl, sizeof(fullUrl), "%s/upload", BaseUrl);
|
||||||
curl_easy_setopt_string(curl, CURLOPT_URL, fullUrl);
|
curl_easy_setopt_string(curl, CURLOPT_URL, fullUrl);
|
||||||
curl_easy_perform_thread(curl, onComplete);
|
curl_easy_perform_thread(curl, onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
public onComplete(Handle:hndl, CURLcode:code)
|
public void onComplete(Handle hndl, CURLcode code)
|
||||||
{
|
{
|
||||||
if(code != CURLE_OK)
|
if(code != CURLE_OK)
|
||||||
{
|
{
|
||||||
new String:error_buffer[256];
|
char error_buffer[256];
|
||||||
curl_easy_strerror(code, error_buffer, sizeof(error_buffer));
|
curl_easy_strerror(code, error_buffer, sizeof(error_buffer));
|
||||||
CloseHandle(output_file);
|
CloseHandle(output_file);
|
||||||
CloseHandle(hndl);
|
CloseHandle(hndl);
|
||||||
|
|
@ -149,16 +152,16 @@ public onComplete(Handle:hndl, CURLcode:code)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShowResponse()
|
void ShowResponse()
|
||||||
{
|
{
|
||||||
new Handle:resultFile = OpenFile("output_demo.json", "r");
|
Handle resultFile = OpenFile("output_demo.json", "r");
|
||||||
new String:output[512];
|
char output[512];
|
||||||
ReadFileString(resultFile, output, sizeof(output));
|
ReadFileString(resultFile, output, sizeof(output));
|
||||||
PrintToChatAll("[demos.tf]: %s", output);
|
PrintToChatAll("[demos.tf]: %s", output);
|
||||||
LogToGame("[demos.tf]: %s", output);
|
LogToGame("[demos.tf]: %s", output);
|
||||||
|
|
||||||
new String:demoid[16];
|
char demoid[16];
|
||||||
new String:url[256];
|
char url[256];
|
||||||
|
|
||||||
char url_parts[4][16];
|
char url_parts[4][16];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================
|
========================================
|
||||||
The Following CURLOPT_* NOT support:
|
The Following CURLOPT_* NOT support
|
||||||
ERRORBUFFER // use curl_get_error_buffer
|
ERRORBUFFER // use curl_get_error_buffer
|
||||||
WRITEINFO // ???
|
WRITEINFO // ???
|
||||||
PROGRESSFUNCTION // unused
|
PROGRESSFUNCTION // unused
|
||||||
|
|
@ -52,7 +52,7 @@ CLOSESOCKETDATA // unsupport
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================
|
========================================
|
||||||
The Following CURLOPT_* supports the "file://" notation.
|
The Following CURLOPT_* supports the "file //" notation.
|
||||||
COOKIEFILE
|
COOKIEFILE
|
||||||
COOKIEJAR
|
COOKIEJAR
|
||||||
RANDOM_FILE
|
RANDOM_FILE
|
||||||
|
|
@ -70,14 +70,14 @@ SSH_KNOWNHOSTS
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================
|
========================================
|
||||||
The Following CURLINFO_* NOT support:
|
The Following CURLINFO_* NOT support
|
||||||
CURLINFO_SLIST
|
CURLINFO_SLIST
|
||||||
|
|
||||||
========================================*/
|
========================================*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================
|
========================================
|
||||||
The Following CURLFORM_* NOT support:
|
The Following CURLFORM_* NOT support
|
||||||
CURLFORM_PTRNAME
|
CURLFORM_PTRNAME
|
||||||
CURLFORM_PTRCONTENTS
|
CURLFORM_PTRCONTENTS
|
||||||
CURLFORM_ARRAY
|
CURLFORM_ARRAY
|
||||||
|
|
@ -126,6 +126,7 @@ enum SendRecv_Act {
|
||||||
enum Openssl_Hash {
|
enum Openssl_Hash {
|
||||||
Openssl_Hash_MD5 = 0,
|
Openssl_Hash_MD5 = 0,
|
||||||
Openssl_Hash_MD4,
|
Openssl_Hash_MD4,
|
||||||
|
Openssl_Hash_MD2,
|
||||||
Openssl_Hash_SHA,
|
Openssl_Hash_SHA,
|
||||||
Openssl_Hash_SHA1,
|
Openssl_Hash_SHA1,
|
||||||
Openssl_Hash_SHA224,
|
Openssl_Hash_SHA224,
|
||||||
|
|
@ -150,8 +151,8 @@ enum Openssl_Hash {
|
||||||
*/
|
*/
|
||||||
typeset CURL_OnComplete
|
typeset CURL_OnComplete
|
||||||
{
|
{
|
||||||
function void(Handle hndl, CURLcode code);
|
function void (Handle hndl, CURLcode code);
|
||||||
function void(Handle hndl, CURLcode code, any data);
|
function void (Handle hndl, CURLcode code , any data);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -164,8 +165,8 @@ typeset CURL_OnComplete
|
||||||
*/
|
*/
|
||||||
typeset CURL_OnSend
|
typeset CURL_OnSend
|
||||||
{
|
{
|
||||||
function SendRecv_Act(Handle hndl, CURLcode code, const int last_sent_dataSize);
|
function SendRecv_Act (Handle hndl, CURLcode code, const int last_sent_dataSize);
|
||||||
function SendRecv_Act(Handle hndl, CURLcode code, const int last_sent_dataSize, any data);
|
function SendRecv_Act (Handle hndl, CURLcode code, const int last_sent_dataSize, any data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -178,8 +179,8 @@ typeset CURL_OnSend
|
||||||
*/
|
*/
|
||||||
typeset CURL_OnReceive
|
typeset CURL_OnReceive
|
||||||
{
|
{
|
||||||
function SendRecv_Act(Handle hndl, CURLcode code, const char[] receiveData, int dataSize);
|
function SendRecv_Act (Handle hndl, CURLcode code, const char[] receiveData, const int dataSize);
|
||||||
function SendRecv_Act(Handle hndl, CURLcode code, const char[] receiveData, int dataSize, any data);
|
function SendRecv_Act (Handle hndl, CURLcode code, const char[] receiveData, const int dataSize, any data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -191,20 +192,20 @@ typeset CURL_OnReceive
|
||||||
*/
|
*/
|
||||||
typeset Openssl_Hash_Complete
|
typeset Openssl_Hash_Complete
|
||||||
{
|
{
|
||||||
function void(const bool success, const char[] buffer);
|
function void (const bool success, const char[] buffer);
|
||||||
function void(const bool success, const char[] buffer, any data);
|
function void (const bool success, const char[] buffer, any data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typeset CURL_Function_CB
|
typeset CURL_Function_CB
|
||||||
{
|
{
|
||||||
// CURLOPT_WRITEFUNCTION
|
// CURLOPT_WRITEFUNCTION
|
||||||
function void(Handle hndl, const char[] buffer, int bytes, int nmemb);
|
function void (Handle hndl, const char[] buffer, const int bytes, const int nmemb);
|
||||||
function void(Handle hndl, const char[] buffer, int bytes, int nmemb, any data);
|
function void (Handle hndl, const char[] buffer, const int bytes, const int nmemb, any data);
|
||||||
|
|
||||||
// CURLOPT_READFUNCTION
|
// CURLOPT_READFUNCTION
|
||||||
function void(Handle hndl, int bytes, int nmemb);
|
function void (Handle hndl, const int bytes, const int nmemb);
|
||||||
function void(Handle hndl, int bytes, int nmemb, any data);
|
function void (Handle hndl, const int bytes, const int nmemb, any data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
|
@ -226,7 +227,7 @@ native Handle curl_easy_init();
|
||||||
* @ param String buffer The value to set the option to.
|
* @ param String buffer The value to set the option to.
|
||||||
* @ return bool 1 on success. 0 = The option not accept string or unsupport.
|
* @ return bool 1 on success. 0 = The option not accept string or unsupport.
|
||||||
*/
|
*/
|
||||||
native bool curl_easy_setopt_string(Handle hndl, CURLoption opt, char []buffer);
|
native bool curl_easy_setopt_string(Handle hndl, CURLoption opt, const char[] buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a curl option for CURLOPTTYPE_LONG type
|
* Set a curl option for CURLOPTTYPE_LONG type
|
||||||
|
|
@ -242,8 +243,8 @@ native bool curl_easy_setopt_int(Handle hndl, CURLoption opt, int value);
|
||||||
* Set a curl option for CURLOPTTYPE_LONG type
|
* Set a curl option for CURLOPTTYPE_LONG type
|
||||||
* @ example"
|
* @ example"
|
||||||
new opt[][2] = {
|
new opt[][2] = {
|
||||||
{_:CURLOPT_NOPROGRESS,1},
|
{_ CURLOPT_NOPROGRESS,1},
|
||||||
{_:CURLOPT_VERBOSE,0}
|
{_ CURLOPT_VERBOSE,0}
|
||||||
};
|
};
|
||||||
*
|
*
|
||||||
* @ param Handle hndl The handle of the curl to be used. May be INVALID_HANDLE if not essential.
|
* @ param Handle hndl The handle of the curl to be used. May be INVALID_HANDLE if not essential.
|
||||||
|
|
@ -251,7 +252,7 @@ native bool curl_easy_setopt_int(Handle hndl, CURLoption opt, int value);
|
||||||
* @ param cell_t array_size The array size.
|
* @ param cell_t array_size The array size.
|
||||||
* @ return bool 1 on success. 0 = The option not accept integer or unsupport.
|
* @ return bool 1 on success. 0 = The option not accept integer or unsupport.
|
||||||
*/
|
*/
|
||||||
native bool curl_easy_setopt_int_array(Handle hndl, int [][]array, int array_size);
|
native bool curl_easy_setopt_int_array(Handle hndl, int[][] array, int array_size); // int array[][2]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a curl option for CURLOPTTYPE_OFF_T type
|
* Set a curl option for CURLOPTTYPE_OFF_T type
|
||||||
|
|
@ -261,7 +262,7 @@ native bool curl_easy_setopt_int_array(Handle hndl, int [][]array, int array_siz
|
||||||
* @ param String buffer The value to set the option to.
|
* @ param String buffer The value to set the option to.
|
||||||
* @ return bool 1 on success. 0 = The option not accept string or unsupport.
|
* @ return bool 1 on success. 0 = The option not accept string or unsupport.
|
||||||
*/
|
*/
|
||||||
native bool curl_easy_setopt_int64(Handle hndl, CURLoption opt, const char []buffer);
|
native bool curl_easy_setopt_int64(Handle hndl, CURLoption opt, const char buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a curl option for CURLOPTTYPE_OBJECTPOINT type
|
* Set a curl option for CURLOPTTYPE_OBJECTPOINT type
|
||||||
|
|
@ -350,7 +351,7 @@ native bool curl_send_recv_IsWaiting(Handle hndl);
|
||||||
* @ param cell_t size if specified the \0 terminator will not be included
|
* @ param cell_t size if specified the \0 terminator will not be included
|
||||||
* @ noreturn
|
* @ noreturn
|
||||||
*/
|
*/
|
||||||
native void curl_set_send_buffer(Handle hndl, const char []data, int size=-1);
|
native void curl_set_send_buffer(Handle hndl, const char[] data, int size=-1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the receive data size for send & receive curl handle
|
* Send the receive data size for send & receive curl handle
|
||||||
|
|
@ -383,7 +384,7 @@ native void curl_set_recv_timeout(Handle hndl, int timeout);
|
||||||
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
||||||
* @ noreturn
|
* @ noreturn
|
||||||
*/
|
*/
|
||||||
native void curl_get_error_buffer(Handle hndl, char []buffer, int maxlen);
|
native void curl_get_error_buffer(Handle hndl, char[] buffer, int maxlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract information from a curl handle. (CURLINFO_STRING only)
|
* Extract information from a curl handle. (CURLINFO_STRING only)
|
||||||
|
|
@ -393,7 +394,7 @@ native void curl_get_error_buffer(Handle hndl, char []buffer, int maxlen);
|
||||||
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
||||||
* @ return The CURLcode code, see cURL_header.inc
|
* @ return The CURLcode code, see cURL_header.inc
|
||||||
*/
|
*/
|
||||||
native CURLcode curl_easy_getinfo_string(Handle hndl, CURLINFO info, char []buffer, int maxlen);
|
native CURLcode curl_easy_getinfo_string(Handle hndl, CURLINFO info, char[] buffer, int maxlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract information from a curl handle. (CURLINFO_LONG, CURLINFO_DOUBLE only)
|
* Extract information from a curl handle. (CURLINFO_LONG, CURLINFO_DOUBLE only)
|
||||||
|
|
@ -412,7 +413,7 @@ native CURLcode curl_easy_getinfo_int(Handle hndl, CURLINFO info, any &value);
|
||||||
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
||||||
* @ return 1 on success.
|
* @ return 1 on success.
|
||||||
*/
|
*/
|
||||||
native bool curl_easy_escape(Handle hndl, const char []url, char []buffer, int maxlen);
|
native bool curl_easy_escape(Handle hndl, const char[] url, char[] buffer, int maxlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL decodes the given string
|
* URL decodes the given string
|
||||||
|
|
@ -422,7 +423,7 @@ native bool curl_easy_escape(Handle hndl, const char []url, char []buffer, int m
|
||||||
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
||||||
* @ return The output length.
|
* @ return The output length.
|
||||||
*/
|
*/
|
||||||
native int curl_easy_unescape(Handle hndl, const char []url, char []buffer, int maxlen);
|
native int curl_easy_unescape(Handle hndl, const char[] url, char[] buffer, int maxlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return string describing error code
|
* Return string describing error code
|
||||||
|
|
@ -431,7 +432,7 @@ native int curl_easy_unescape(Handle hndl, const char []url, char []buffer, int
|
||||||
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
||||||
* @ noreturn
|
* @ noreturn
|
||||||
*/
|
*/
|
||||||
native void curl_easy_strerror(CURLcode code, char []buffer, int maxlen);
|
native void curl_easy_strerror(CURLcode code, char[] buffer, int maxlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the libcurl version string
|
* Returns the libcurl version string
|
||||||
|
|
@ -439,7 +440,7 @@ native void curl_easy_strerror(CURLcode code, char []buffer, int maxlen);
|
||||||
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
||||||
* @ noreturn
|
* @ noreturn
|
||||||
*/
|
*/
|
||||||
native void curl_version(char []buffer, int maxlen);
|
native void curl_version(char[] buffer, int maxlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the libcurl supported protocols string
|
* Returns the libcurl supported protocols string
|
||||||
|
|
@ -447,7 +448,7 @@ native void curl_version(char []buffer, int maxlen);
|
||||||
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
||||||
* @ noreturn
|
* @ noreturn
|
||||||
*/
|
*/
|
||||||
native void curl_protocols(char []buffer, int maxlen);
|
native void curl_protocols(char[] buffer, int maxlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the libcurl supported features
|
* Returns the libcurl supported features
|
||||||
|
|
@ -471,7 +472,7 @@ native int curl_features();
|
||||||
* @ param mode Open mode.
|
* @ param mode Open mode.
|
||||||
* @ return A Handle to the file, INVALID_HANDLE on open error.
|
* @ return A Handle to the file, INVALID_HANDLE on open error.
|
||||||
*/
|
*/
|
||||||
native Handle curl_OpenFile(const char []file, const char []mode);
|
native Handle curl_OpenFile(const char[] file, const char[] mode);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -521,17 +522,17 @@ native Handle curl_slist();
|
||||||
* @ param String buffer The string to add
|
* @ param String buffer The string to add
|
||||||
* @ noreturn
|
* @ noreturn
|
||||||
*/
|
*/
|
||||||
native void curl_slist_append(Handle hndl, const char []buffer);
|
native void curl_slist_append(Handle hndl, const char[] buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash a file
|
* Hash a file
|
||||||
* @ parma String file The file path. supports the "file://" notation.
|
* @ parma String file The file path. supports the "file //" notation.
|
||||||
* @ param Openssl_Hash algorithm Hash Algorithm.
|
* @ param Openssl_Hash algorithm Hash Algorithm.
|
||||||
* @ param Openssl_Hash_Complete complete_callback The complete callback.
|
* @ param Openssl_Hash_Complete complete_callback The complete callback.
|
||||||
* @ param cell_t value Value to set.
|
* @ param cell_t value Value to set.
|
||||||
* @ noreturn
|
* @ noreturn
|
||||||
*/
|
*/
|
||||||
native curl_hash_file(const char []file, Openssl_Hash algorithm, Openssl_Hash_Complete complete_callback, any value=0);
|
native void curl_hash_file(const char[] file, Openssl_Hash algorithm, Openssl_Hash_Complete complete_callback, any value=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash a string
|
* Hash a string
|
||||||
|
|
@ -542,14 +543,13 @@ native curl_hash_file(const char []file, Openssl_Hash algorithm, Openssl_Hash_Co
|
||||||
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
* @ param cell_t maxlen Destination buffer length (includes null terminator).
|
||||||
* @ return 1 on success
|
* @ return 1 on success
|
||||||
*/
|
*/
|
||||||
native bool curl_hash_string(const char []input, int dataSize, Openssl_Hash algorithm, char []buffer, int maxlength);
|
native bool curl_hash_string(const char[] input, int dataSize, Openssl_Hash algorithm, char[] buffer, int maxlength);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not edit below this line!
|
* Do not edit below this line!
|
||||||
*/
|
*/
|
||||||
public Extension __ext_curl =
|
public Extension __ext_curl = {
|
||||||
{
|
|
||||||
name = "curl",
|
name = "curl",
|
||||||
file = "curl.ext",
|
file = "curl.ext",
|
||||||
#if defined AUTOLOAD_EXTENSIONS
|
#if defined AUTOLOAD_EXTENSIONS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue