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

Module: Curl


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Levenus Supremus
Junior Member
Join Date: Jan 2012
Location: St.Petersburg
Old 07-27-2016 , 06:20   Module: Curl
Reply With Quote #1

UPDATE
Note the new module https://github.com/Next21Team/AmxxEasyHttp
It has new easy to use API! Without read/write callbacks, problems with certificates and does not require clearing resources.

Description:
AmxxCurl module is a wrapper over libcurl easy interface for amxmodx. Module performs curl's in non-blocking mode.

Download latest version here.

Few words about libcurl (from wiki page):
Quote:
libcurl is a free client-side URL transfer library, supporting FTP, FTPS, Gopher, HTTP, HTTPS, SCP, SFTP, TFTP, Telnet, DICT, the file URI scheme, LDAP, LDAPS, IMAP, POP3, SMTP and RTSP. The library supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, Kerberos, HTTP form-based upload, proxies, cookies, user-plus-password authentication, file transfer resume, and HTTP proxy tunneling.
So, this means that with this module you can send/check mails via IMAP, POP3 protocols; perform HTTPS requests (example); download/upload files over FTP (example). And it's only general capabilities. Here some examples written on C, but it almost that Pawn)

Natives:
All natives you can find in curl.inc, they have the same behaviour that C functions.

Except for some:
1)
Code:
native void:curl_easy_perform(const CURL:handle, const callbackComplite[], const data[] = {}, const data_len = 0)
The function starts curl perform, and upon completion of the transfer will be call callback callbackComplite. In third parameter you can specify an array of user data, wich will be transferred to callbackComplite, and fourth parameter is array length.

If user data set, callback should have the signature:
Code:
public compliteCallback(CURL:curl, CURLcode:code, data[])
else:
Code:
public compliteCallback(CURL:curl, CURLcode:code)
2)
Code:
native CURLcode:curl_easy_getinfo(const CURL:handle, const CURLINFO:info, any:...)
For string type of CURLINFO option, you must set fourth argument - string size:
Code:
new url[64]
curl_easy_getinfo(curl,CURLINFO_EFFECTIVE_URL, url, charsmax(url))
Important things
1) if you are using callback WRITEFUNCTION, always specify the option CURLOPT_BUFFERSIZE. Specify something about 512-1024, or risk getting a stack overflow error.
2) If you are would like to use READFUNCTION callback, set pragma dynamic in 16536 or more:
Code:
#pragma dynamic 16536
Author: Polarhigh (aka Levenus Supremus)
Source code: https://github.com/Polarhigh/AmxxCurl
Releases: https://github.com/Polarhigh/AmxxCurl/releases

Last edited by Levenus Supremus; 02-09-2022 at 05:02. Reason: removed dependence on SoLoader
Levenus Supremus is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-27-2016 , 12:17   Re: Module: Curl
Reply With Quote #2

For amxx module you need install meta plugin? It is so crutch.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Levenus Supremus
Junior Member
Join Date: Jan 2012
Location: St.Petersburg
Old 07-27-2016 , 12:27   Re: Module: Curl
Reply With Quote #3

openssl library is critically important library, such a solution allows to hot swap if in openssl current version vulnerability will found.

Last edited by Levenus Supremus; 07-27-2016 at 12:28.
Levenus Supremus is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 07-27-2016 , 16:05   Re: Module: Curl
Reply With Quote #4

Omg you made it first I though of adding it into ThreadedSockets

Also i don't think there is a need for it to be a MetaMod Plugin, even if its linked to Metamod or Amxmodx (which is in-turn linked to MM), the outcome would be the same.
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here
Shooting King is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-27-2016 , 16:46   Re: Module: Curl
Reply With Quote #5

Quote:
Originally Posted by Levenus Supremus View Post
openssl library is critically important library, such a solution allows to hot swap if in openssl current version vulnerability will found.
Can't you integrate openssl library into your module?
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-27-2016 , 18:04   Re: Module: Curl
Reply With Quote #6

Quote:
Originally Posted by PRoSToTeM@ View Post
Can't you integrate openssl library into your module?
He has just stated WHY it is important (and critical) to have it separely...
__________________

Last edited by Neeeeeeeeeel.-; 07-27-2016 at 18:05.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-27-2016 , 18:49   Re: Module: Curl
Reply With Quote #7

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
He has just stated WHY it is important (and critical) to have it separely...
Missed out, thx.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Destro-
Veteran Member
Join Date: Jun 2010
Location: $me->location();
Old 07-27-2016 , 21:41   Re: Module: Curl
Reply With Quote #8

ohh, good module
__________________

Last edited by Destro-; 07-28-2016 at 13:20.
Destro- is offline
Levenus Supremus
Junior Member
Join Date: Jan 2012
Location: St.Petersburg
Old 07-28-2016 , 09:22   Re: Module: Curl
Reply With Quote #9

Quote:
Originally Posted by Shooting King View Post
Omg you made it first I though of adding it into ThreadedSockets

Also i don't think there is a need for it to be a MetaMod Plugin, even if its linked to Metamod or Amxmodx (which is in-turn linked to MM), the outcome would be the same.
I'm not first too)
https://github.com/alldroll/curl_module

Ok, maybe you and PRoSToTeM@ rights, but i thought that it better and simpler.

Quote:
Originally Posted by PRoSToTeM@ View Post
Can't you integrate openssl library into your module?
In future.
Levenus Supremus is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 08-04-2016 , 16:28   Re: Module: Curl
Reply With Quote #10

The natives should be documented with comments explaining how they work. I know they can be looked up, but an include file in itself should give you a general idea of how to work with the natives.
PartialCloning 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 09:18.


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