{"_id":"@autoit-gui-skeleton/ags-wrapper-curl","_rev":"1-e28c2e7c826543ffdda09f18065d27ef","name":"@autoit-gui-skeleton/ags-wrapper-curl","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@autoit-gui-skeleton/ags-wrapper-curl","version":"1.0.0","description":"AGS package for the library Curl.au3, created by Ward. It provides an own implementation of libcurl in AutoIt","author":{"name":"v20100v","email":"vb20100bv@gmail.com","url":"https://github.com/v20100v"},"contributors":[{"name":"v20100v","email":"vb20100bv@gmail.com","url":"https://github.com/v20100v"}],"license":"MIT","keywords":["AGS","AutoIt","AutoIt-GUI-Skeleton","AGS-wrapper","curl","libcurl"],"homepage":"https://autoit-gui-skeleton.github.io/","repository":{"url":"git+https://github.com/autoit-gui-skeleton/ags-wrapper-curl.git","type":"git"},"bugs":{"url":"https://github.com/autoit-gui-skeleton/ags-wrapper-curl/issues"},"AGS":{"framework":{"version":"1.0.0"},"AutoIt":{"version":"3.3.14.5"},"wrapper":{"main":"Curl.au3"}},"dependencies":{"@autoit-gui-skeleton/ags-wrapper-binary-call":"^1.0.2"},"gitHead":"4ce63f9eb927927a061f2cdd3b9a1db6d05d6720","_id":"@autoit-gui-skeleton/ags-wrapper-curl@1.0.0","_nodeVersion":"12.18.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-EA1GuPPQB5gjwc45LxyRLoH03f+5QlwWDdhvplIzMjorr0Q2/CzRy7UHi56kQTNG80zLfRMF3xXcRHryZNJuiQ==","shasum":"0fd3fa76fd77aa84723d40fa141379e5ae6b1f20","tarball":"https://registry.npmjs.org/@autoit-gui-skeleton/ags-wrapper-curl/-/ags-wrapper-curl-1.0.0.tgz","fileCount":113,"unpackedSize":851746,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhn46eCRA9TVsSAnZWagAAYuUP/1Ax6rIB3h8I4j09it8v\n7WzSfwWSZPJsG3yxlw3tXaan+uU4T3YTMiTaLgC2zUnlEfIDwOn1xjKG7tOX\nPwxPQRB4MH4XMuemtYWb2PD5XV7h+q9KHWBHI8pAg6C/5m+iWQscL5bEUyk1\nRmyZVN00EsMV+U8g07i0f7+QqoaosgXEgLUL4PhtLsF79t3QKikAvIqGB7aC\nDN/XW2CvtXb9sTCVJCSQT3YwZTLxs4J8sXldHXz7dvGxqJLP5ehvtSIkkEMW\n9yeApvcweT1Ta+fKUdmyfC6TQqpKR6QPChbsiEVTqADIfZcKE6wM+MdA9RQB\nAnLNvvznTa8oWdvzira6cRUUdWj/CbREnQXTO9+lTmbBsyj8HOT1NNxxcj5l\nz5g/J2P/8af1uTnJlS7a48rqL0v0NLb7HixJnaBJvccbuSphzgfa7tuCCTIG\nOPXNhbMcDYvCDyLwPo2IjGib09tpRSJeko/hooeiAf7AIhMiFXsHIMm9tAat\na18/Llsdp23WyTfbClxiov280rUdySCFrTU1dLfKJ1D7LlK9vfeyV9MlOrQQ\nKOh4OVlK/vsd2bxAxuRgkl7Mxx1ShqfLn5NcJePRmv3LO/cpQ84NI3KtRsY9\n0ZLTYrqxWdraLW3tpHA6/lAWdKyYnmTEIlcG9T1OVri9rkJHsmiymL8tWrTB\nlVJx\r\n=+F0E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHOZVrUbYBuB6drxtw7iWQHyp1dsWg8o1X8HjsQ5503gAiEA9fSzxe6JcERrHLc9xMJZSwOpAk6ONZA3ccNq7OAWp2A="}]},"_npmUser":{"name":"v20100v","email":"vb20100bv@gmail.com"},"directories":{},"maintainers":[{"name":"v20100v","email":"vb20100bv@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ags-wrapper-curl_1.0.0_1637846686283_0.44153036266676304"},"_hasShrinkwrap":false}},"time":{"created":"2021-11-25T13:24:46.216Z","1.0.0":"2021-11-25T13:24:46.561Z","modified":"2022-04-04T16:37:26.560Z"},"maintainers":[{"name":"v20100v","email":"vb20100bv@gmail.com"}],"description":"AGS package for the library Curl.au3, created by Ward. It provides an own implementation of libcurl in AutoIt","homepage":"https://autoit-gui-skeleton.github.io/","keywords":["AGS","AutoIt","AutoIt-GUI-Skeleton","AGS-wrapper","curl","libcurl"],"repository":{"url":"git+https://github.com/autoit-gui-skeleton/ags-wrapper-curl.git","type":"git"},"contributors":[{"name":"v20100v","email":"vb20100bv@gmail.com","url":"https://github.com/v20100v"}],"author":{"name":"v20100v","email":"vb20100bv@gmail.com","url":"https://github.com/v20100v"},"bugs":{"url":"https://github.com/autoit-gui-skeleton/ags-wrapper-curl/issues"},"license":"MIT","readme":"AGS-wrapper-curl\r\n================\r\n\r\n> [AutoIt Gui Skeleton](https://autoit-gui-skeleton.github.io/) package for wrapping the library [Curl.au3](https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn/) created by Ward. See this package on [npmjs.com](https://www.npmjs.com/package/@autoit-gui-skeleton/ags-wrapper-curl)\r\n\r\n\r\n\r\n<br/>\r\n\r\n## Curl Ward library\r\n\r\n### Introduction\r\n\r\nThis library provides an implementation of libcurl with SSL support. It's built with another Ward library [BinaryCall](https://www.autoitscript.com/forum/topic/162366-binarycall-udf-write-subroutines-in-c-call-in-autoit/)\r\n\r\nThe Features:\r\n\r\n* Pure AutoIt script, no DLLs needed.\r\n* Build with SSL/TLS and zlib support (without libidn, libiconv, libssh2).\r\n* Full easy-interface and partial multi-interface support.\r\n* Data can read from or write to autoit variables or files.\r\n* Smaller code size (compare to most libcurl DLL).\r\n\r\nThe version information of this build:\r\n - Curl Version: libcurl/7.42.1\r\n - SSL Version: mbedTLS/1.3.10\r\n - Libz Version: 1.2.8\r\n - Protocols: ftp,ftps,http,https\r\n\r\nHere are the helper functions (not include in libcurl library).\r\n\r\n    Curl_DataWriteCallback()\r\n    Curl_DataReadCallback()\r\n    Curl_FileWriteCallback()\r\n    Curl_FileReadCallback()\r\n    Curl_Data_Put()\r\n    Curl_Data_Get()\r\n    Curl_Data_Cleanup()\r\n\r\n### Examples\r\n\r\n#### Get HTTP header and content from google\r\n\r\n```autoit\r\n#Include \"../Curl.au3\"\r\n\r\n; How to get html or header data?\r\n;   1. Set $CURLOPT_WRITEFUNCTION and $CURLOPT_HEADERFUNCTION to Curl_DataWriteCallback()\r\n;   2. Set $CURLOPT_WRITEDATA or $CURLOPT_HEADERDATA to any number as identify\r\n;   3. Use Curl_Data_Get() to read the returned data in binary format\r\n;   4. Use Curl_Data_Cleanup() to remove the data\r\n\r\nLocal $Curl = Curl_Easy_Init()\r\nIf Not $Curl Then Return\r\n\r\nLocal $Html = $Curl ; any number as identify\r\nLocal $Header = $Curl + 1 ; any number as identify\r\n\r\n; Curl configuration\r\nCurl_Easy_Setopt($Curl, $CURLOPT_URL, \"https://www.google.com\")\r\nCurl_Easy_Setopt($Curl, $CURLOPT_USERAGENT, \"AutoIt/Curl\")\r\nCurl_Easy_Setopt($Curl, $CURLOPT_FOLLOWLOCATION, 1)\r\nCurl_Easy_Setopt($Curl, $CURLOPT_ACCEPT_ENCODING, \"gzip\") ; or set \"\" use all built-in supported encodings\r\nCurl_Easy_Setopt($Curl, $CURLOPT_WRITEFUNCTION, Curl_DataWriteCallback())\r\nCurl_Easy_Setopt($Curl, $CURLOPT_WRITEDATA, $Html)\r\nCurl_Easy_Setopt($Curl, $CURLOPT_HEADERFUNCTION, Curl_DataWriteCallback())\r\nCurl_Easy_Setopt($Curl, $CURLOPT_HEADERDATA, $Header)\r\nCurl_Easy_Setopt($Curl, $CURLOPT_COOKIE, \"tool=curl; script=autoit; fun=yes;\")\r\nCurl_Easy_Setopt($Curl, $CURLOPT_TIMEOUT, 30)\r\nCurl_Easy_Setopt($Curl, $CURLOPT_SSL_VERIFYPEER, 0)\r\n\r\n; Perform curl request\r\nLocal $Code = Curl_Easy_Perform($Curl)\r\nIf $Code = $CURLE_OK Then\r\n\tConsoleWrite(\"Content Type: \" & Curl_Easy_GetInfo($Curl, $CURLINFO_CONTENT_TYPE) & @LF)\r\n\tConsoleWrite(\"Download Size: \" & Curl_Easy_GetInfo($Curl, $CURLINFO_SIZE_DOWNLOAD) & @LF)\r\n\r\n\tMsgBox(0, 'Header', BinaryToString(Curl_Data_Get($Header)))\r\n\tMsgBox(0, 'Html', BinaryToString(Curl_Data_Get($Html)))\r\nElse\r\n\tConsoleWrite(Curl_Easy_StrError($Code) & @LF)\r\nEndIf\r\n\r\nCurl_Easy_Cleanup($Curl)\r\nCurl_Data_Cleanup($Header)\r\nCurl_Data_Cleanup($Html)\r\n```\r\n\r\n\r\n### Deals with proxy settings\r\n\r\nBy default, libcurl respects the proxy environment variables named `http_proxy`, `ftp_proxy`, `sftp_proxy` etc. If set, libcurl will use the specified proxy for that URL scheme. So for a \"FTP://\" URL, the ftp_proxy is considered. all_proxy is used if no protocol specific proxy was set. If `no_proxy` is set, it is the exact equivalent of setting the CURLOPT_NOPROXY option. But if you want to ovveride envrionnement variables, it's possible with the `$CURLOPT_PROXY` and `CURLOPT_NOPROXY` options.\r\n\r\nTo set a proxy, use :\r\n\r\n```\r\nCurl_Easy_Setopt($Curl, $CURLOPT_PROXY, 'https://myProxy.com:8080');\r\n```\r\n\r\nTo disable default proxy configuration, use :\r\n\r\n```autoit\r\nCurl_Easy_Setopt($Curl, $CURLOPT_PROXY, '');\r\n```\r\n\r\n### Make request with multi interface for non-GUI blocking\r\n\r\nThe multi interface provides in libcurl offers several abilities that the easy interface (default mode use in libcurl) does not. They are mainly:\r\n\r\n1. Enable a \"pull\" interface. The application that uses libcurl decides where and when to ask libcurl to get/send data.\r\n\r\n2. Enable multiple simultaneous transfers in the same thread without making it complicated for the application.\r\n\r\n3. Enable the application to wait for action on its own file descriptors and curl's file descriptors simultaneously.\r\n\r\n4. Enable event-based handling and scaling transfers up to and beyond thousands of parallel connections.\r\n\r\n> See more : [https://curl.se/libcurl/c/libcurl-multi.html](https://curl.se/libcurl/c/libcurl-multi.html)\r\n\r\n\r\n```autoit\r\n\r\nLocal $Curl = Curl_Easy_Init()\r\nIf Not $Curl Then Return\r\n\r\nCurl_Easy_Setopt($Curl, $CURLOPT_URL, \"http://www.google.com\")\r\nCurl_Easy_Setopt($Curl, $CURLOPT_USERAGENT, \"AutoIt/Curl\")\r\nCurl_Easy_Setopt($Curl, $CURLOPT_FOLLOWLOCATION, 1)\r\nCurl_Easy_Setopt($Curl, $CURLOPT_ACCEPT_ENCODING, \"\")\r\nCurl_Easy_Setopt($Curl, $CURLOPT_WRITEFUNCTION, Curl_DataWriteCallback())\r\nCurl_Easy_Setopt($Curl, $CURLOPT_WRITEDATA, $Curl)\r\nCurl_Easy_Setopt($Curl, $CURLOPT_HEADERFUNCTION, Curl_DataWriteCallback())\r\nCurl_Easy_Setopt($Curl, $CURLOPT_HEADERDATA, $Curl + 1)\r\n\r\nLocal $Multi = Curl_Multi_Init()\r\nIf Not $Multi Then Return\r\nCurl_Multi_Add_Handle($Multi, $Curl)\r\n\r\nLocal $Running, $MsgsInQueue\r\nDo\r\n\tCurl_Multi_Perform($Multi, $Running)\r\n\tLocal $CURLMsg = Curl_Multi_Info_Read($Multi, $MsgsInQueue)\r\n\tIf DllStructGetData($CURLMsg, \"msg\") = $CURLMSG_DONE Then\r\n\t\tLocal $Curl = DllStructGetData($CURLMsg, \"easy_handle\")\r\n\t\tLocal $Code = DllStructGetData($CURLMsg, \"data\")\r\n\t\tIf $Code = $CURLE_OK Then\r\n\t\t\tConsoleWrite(\"Content Type: \" & Curl_Easy_GetInfo($Curl, $CURLINFO_CONTENT_TYPE) & @LF)\r\n\t\t\tConsoleWrite(\"Download Size: \" & Curl_Easy_GetInfo($Curl, $CURLINFO_SIZE_DOWNLOAD) & @LF)\r\n\r\n\t\t\tMsgBox(0, 'Header', BinaryToString(Curl_Data_Get($Curl + 1)))\r\n\t\t\tMsgBox(0, 'Html', BinaryToString(Curl_Data_Get($Curl)))\r\n\t\tElse\r\n\t\t\tConsoleWrite(Curl_Easy_StrError($Code) & @LF)\r\n\t\tEndIf\r\n\t\tCurl_Multi_Remove_Handle($Multi, $Curl)\r\n\t\tCurl_Easy_Cleanup($Curl)\r\n\t\tCurl_Data_Cleanup($Curl)\r\n\t\tCurl_Data_Cleanup($Curl + 1)\r\n\tEndIf\r\n\tConsoleWrite(\"non-GUI-blocking\" & @LF)\r\n\tSleep(10)\r\nUntil $Running = 0\r\nCurl_Multi_Cleanup($Multi)\r\nConsoleWrite(@LF)\r\n```\r\n\r\n### Another examples\r\n\r\nSee the [Examples](./Examples) script for detail usage.\r\n\r\n\r\n<br/>\r\n\r\n## How to install AGS-wrapper-curl ?\r\n\r\nWe assume that you have already install [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com/lang/en/), for example by taking a [Chocolatey](https://chocolatey.org/). AGS framework use Yarn for manage dependencies.\r\n\r\nTo add this package into your AutoIt project, just type in the root folder of your AGS project where the `package.json` is stored. You can also modify the `dependencies` property of this json file and use the yarn [install](https://yarnpkg.com/en/docs/usage) command. It is easier to use the add command :\r\n\r\n```\r\nλ  yarn add @autoit-gui-skeleton/ags-wrapper-curl --modules-folder vendor\r\n```\r\n\r\nThe property `dependencies` of the  `package.json` file is updated consequently, and all package dependencies, as well as daughter dependencies of parent dependencies, are installed in the `./vendor/@autoit-gui-skeleton/` directory. Note that with an AGS project, it is not necessary to explicitly write this option `--modules-folder vendor` on the command line, thanks to the `.yarnrc` file stored at the root of the project. Yarn automatically use `.yarnrc` file to add an additional configuration of options.\r\n\r\n```\r\n #./.yarnrc\r\n --modules-folder vendor\r\n ```\r\n\r\nFinally to use this library in your AutoIt program, you need to include this library in the main program. There is no need for additional configuration to use it.\r\n\r\n```autoit\r\n#include './vendor/@autoit-gui-skeleton/ags-wrapper-curl/Curl.au3'\r\n```\r\n\r\n\r\n<br/>\r\n\r\n## What is AGS (AutoIt Gui Skeleton) ?\r\n\r\n[AutoIt Gui Skeleton](https://autoit-gui-skeleton.github.io/) give an environment for developers, that makes it easy to build AutoIt applications. To do this AGS proposes to use conventions and a standardized architecture in order to simplify the code organization, and thus its maintainability. It also gives tools to help developers in recurring tasks specific to software engineering.\r\n\r\n> More information about [AGS framework](https://autoit-gui-skeleton.github.io/)\r\n\r\nAGS provides a dependency manager for AutoIt library. It uses the Node.js ecosystem and its dependency manager npm and its evolution Yarn. All AGS packages are hosted in npmjs.org repository belong to the [@autoit-gui-skeleton](https://www.npmjs.com/search?q=autoit-gui-skeleton) organization. And in AGS you can find two types of package :\r\n\r\n- An **AGS-component** is an AutoIt library, that you can easy use in your AutoIt project built with the AGS framework. It provides some features for application that can be implement without painless.\r\n- An **AGS-wrapper** is a simple wrapper for an another library created by another team/developer.\r\n\r\n> More information about [dependency manager for AutoIt in AGS](https://autoit-gui-skeleton.github.io//2018/07/10/ags_dependencies_manager_for_AutoIt.html)\r\n\r\n\r\n<br/>\r\n\r\n## About\r\n\r\n### Acknowledgments\r\n\r\nAcknowledgments for [Ward](https://www.autoitscript.com/forum/profile/10768-ward/) work and its library Curl.au3 and BinaryCall.au3.\r\n\r\n### Contributing\r\n\r\nComments, pull-request & stars are always welcome !\r\n\r\n### License\r\n\r\nCopyright (c) 2018 by [v20100v](https://github.com/v20100v). Released under the MIT license.\r\n","readmeFilename":"README.md"}