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

[EXTENSION] NEOCURL + hash


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sapphonie
Junior Member
Join Date: Aug 2020
Location: ohio
Old 07-15-2023 , 09:45   [EXTENSION] NEOCURL + hash
Reply With Quote #1

FORKED FROM https://forums.alliedmods.net/showthread.php?t=152216

This is a maintained, modern version of the old, crusty curl extension.

It has not been super well tested, but it should be a drop in replacement.


Quote:
Originally Posted by raydan View Post

A cURL extension in Sourcemod

A free and easy-to-use client-side URL transfer library, supporting DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos), file transfer resume, http proxy tunneling and more!

cURL Website: http://curl.haxx.se/

Current Version: 2.0.0.0-BETA

This a a sourcemod extension, using libcurl
Current libcurl Information:
Version: [B]libcurl/8.0.1-DEV - I don't remember the specific version but it is featureful
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp

The extension includes 2 hash function (file hash, string hash), provided by openssl library:
Code:
enum Openssl_Hash {
 Openssl_Hash_MD5 = 0,
 Openssl_Hash_MD4,
 Openssl_Hash_MD2, // DEPRECATED
 Openssl_Hash_SHA, // DEPRECATED
 Openssl_Hash_SHA1,
 Openssl_Hash_SHA224,
 Openssl_Hash_SHA256,
 Openssl_Hash_SHA384,
 Openssl_Hash_SHA512,
 Openssl_Hash_RIPEMD160,
// MORE WILL SOON BE ADDED
};
 
native curl_hash_file(const String:file[], Openssl_Hash:algorithm, Openssl_Hash_Complete:complete_callback, any:value=0);
 
native bool:curl_hash_string(const String:input[], dataSize, Openssl_Hash:algorithm, String:buffer[], maxlength);
More natives in cURL.inc or here



Developer Notes
  • Downloload the curl_examples.zip to see how to use
  • curl_echo.sp echo client test
  • curl_rcon.sp make a source rcon query to other server
  • curl_gmail.sp use read function send a email
  • curl_udp.sp send A2S_INFO to source server & get the result
  • curl_write_function.sp use write function download files
  • see http://curl.haxx.se/libcurl/c/example.html
Self Test
  • compile curl_self_test.sp & run curl_self_test and curl_hash_test
  • All output test files in addons/sourcemod/data/curl_test
    Test #1 Get cURL version & supported protocols
    Test #2 Get a web page
    Test #3 Get ca-bundle.crt for #4
    Test #4 Verify a https website using ca-bundle.crt
    Test #5 Get a web page body & header content to file
    Test #6 Download a image for #7
    Test #7 Upload image using curl_httppost() & get the uploaded image url
    Test #8 Download a file using ftps://
Sourcecode
https://code.google.com/p/sourcemod-curl-extension/

Download
https://code.google.com/p/sourcemod-...downloads/list


the windows version should install the following package (thanks Thrawn2 to figure out)
Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update
http://www.microsoft.com/download/en....aspx?id=26347

REAL source code is over at https://github.com/sapphonie/SM-neocurl-ext/
LATEST RELEASE is over at https://github.com/sapphonie/SM-neoc...ag/v2.0.0-beta

This is in ultra beta so please test it

Ta
__________________
she/her

Last edited by sapphonie; 07-15-2023 at 09:46.
sapphonie is offline
sapphonie
Junior Member
Join Date: Aug 2020
Location: ohio
Old 07-15-2023 , 09:47   Re: [EXTENSION] NEOCURL + hash
Reply With Quote #2

TODONE:
- Auto ci/cd building with github actions using debian-11-slim docker
- recompiled extension and confirmed it passes most self tests

TODO: See github, this won't be updated, but,

- Windows version
- More testing
__________________
she/her
sapphonie is offline
gl4box
New Member
Join Date: Sep 2023
Old 09-27-2023 , 09:55   Re: [EXTENSION] NEOCURL + hash
Reply With Quote #3

Me problem - error 3

code:
Code:
#include <sourcemod>
#include <cURL>

public void OnPluginStart() {
	RegServerCmd("test", cmdTest);
}

public Action:cmdTest(args) {
	new Handle: curl = curl_easy_init();
	
	if(curl) {
		curl_easy_setopt_string(curl, CURLOPT_URL, "https://google.com/");
		new CURLcode: CURLResult = curl_easy_perform(curl);
		
		PrintToServer("%d", CURLResult); // result 3
	}
	
}
Devuan 5, libcurl 7.88

Last edited by gl4box; 09-27-2023 at 09:56.
gl4box is offline
Reply



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 07:06.


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