32#include <scolMemoryHelper.hpp>
45int SCOL_CURL_DATA_CB = 0;
68int destroyCurlObj(mmachine m, SCOL_PTR_TYPE handsys,
int handscol) {
70 SCurl* curlobj = MMgetPointer<SCurl*>(m, MTOP(handscol));
73 MMsetPointer<SCurl*>(m, MTOP(handscol), 0);
76 MMechostr(MSKDEBUG,
"ObjCURL destroyed.\n");
93 MMechostr(0,
"_CRcurlRequest\n");
101 int channel = MMget(m, 0);
104 if (channel == NIL || sUrl == NIL)
106 MMechostr(MSKDEBUG,
"Channel NIL\n");
111 std::string url = MMstartstr(m, MTOP(sUrl));
112 if (!SCurl::CheckUrl(url))
114 MMechostr(MSKDEBUG,
"curlobj failed, bad url\n");
122 MMechostr(MSKDEBUG,
"curlobj failed\n");
123 SAFE_DELETE(curlobj);
129 std::string httpProxy = (
char*)SCgetExtra(
"HTTPproxy");
130 if (!httpProxy.empty() && httpProxy !=
"no")
132 std::string proxy =
"http://";
133 proxy.append(httpProxy);
134 curlobj->SetOption(CURLOPT_PROXY, proxy);
138 if ((MMpushPointer(m, curlobj) != 0))
140 SAFE_DELETE(curlobj);
146 k = OBJcreate(m, OBJCURLSCOL, SCOL_PTR curlobj, 0, 0);
149 MMechostr(MSKDEBUG,
"ok\n");
165 MMechostr(MSKDEBUG,
"_KILLcurlRequest\n");
168 int curlTab = MMget(m, 0);
175 OBJdelTM(m, OBJCURLSCOL, curlTab);
176 MMset(m, 0, ITOM(0));
179 MMechostr(MSKDEBUG,
"ok\n");
196 MMechostr(MSKDEBUG,
"_CALLcurlRequest\n");
199 int curlTab = MMget(m, 2);
207 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
208 if (curlObject == NULL)
215 OBJaddreflex(m, OBJCURLSCOL, SCOL_CURL_DATA_CB);
217 curlObject->CallAsync();
220 MMechostr(MSKDEBUG,
"ok\n");
237 MMechostr(MSKDEBUG,
"_CALLcurlRequestSync\n");
240 int curlTab = MMget(m, 2);
248 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
249 if (curlObject == NULL)
256 OBJaddreflex(m, OBJCURLSCOL, SCOL_CURL_DATA_CB);
258 curlObject->CallSync();
261 MMechostr(MSKDEBUG,
"ok\n");
276 MMechostr(MSKDEBUG,
"_SETcurlRequestHeader\n");
279 int lhead = MMpull(m);
280 int curlTab = MMget(m, 0);
281 if (curlTab == NIL || lhead == NIL)
287 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
288 if (curlObject == NULL)
295 std::vector<std::string> headers;
299 std::string sheader(MMstartstr(m, MTOP(MMfetch(m, lhead, 0))));
300 headers.push_back(sheader);
301 lhead = MTOP(MMfetch(m, lhead, 1));
304 curlObject->SetHeader(headers);
307 MMechostr(MSKDEBUG,
"ok\n");
323 MMechostr(MSKDEBUG,
"_SETcurlOption\n");
326 int ivalue = MMpull(m);
327 int ioption = MMpull(m);
328 int curlTab = MMget(m, 0);
329 if (curlTab == NIL || ioption == NIL)
335 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
336 if (curlObject == NULL)
342 ioption = MTOI(ioption);
343 ivalue = MTOI(ivalue);
345 curlObject->SetOption((CURLoption)ioption, ivalue);
348 MMechostr(MSKDEBUG,
"ok\n");
364 MMechostr(MSKDEBUG,
"_SETcurlOptionList\n");
367 int lvalue = MMpull(m);
368 int ioption = MMpull(m);
369 int curlTab = MMget(m, 0);
370 if (curlTab == NIL || ioption == NIL)
376 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
377 if (curlObject == NULL)
383 ioption = MTOI(ioption);
384 lvalue = MTOP(lvalue);
385 std::vector<std::string> values;
389 std::string svalue(MMstartstr(m, MTOP(MMfetch(m, lvalue, 0))));
390 values.push_back(svalue);
391 lvalue = MTOP(MMfetch(m, lvalue, 1));
394 curlObject->SetOption((CURLoption)ioption, values);
397 MMechostr(MSKDEBUG,
"ok\n");
413 MMechostr(MSKDEBUG,
"_SETcurlOptionS\n");
416 int ivalue = MMpull(m);
417 int ioption = MMpull(m);
418 int curlTab = MMget(m, 0);
419 if (curlTab == NIL || ioption == NIL)
425 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
426 if (curlObject == NULL)
432 ioption = MTOI(ioption);
433 ivalue = MTOP(ivalue);
435 if (ioption == CURLOPT_UPLOAD)
437 int msize = MMsizestr(m, ivalue);
438 char* smess = (
char*)MMstart(m, (ivalue)+1);
439 curlObject->SetOption((CURLoption)ioption, smess, msize);
443 std::string value = MMstartstr(m, ivalue);
444 curlObject->SetOption((CURLoption)ioption, value);
448 MMechostr(MSKDEBUG,
"ok\n");
464 MMechostr(MSKDEBUG,
"_SETcurlOptionFile\n");
467 int ivalue = MMpull(m);
468 int ioption = MMpull(m);
469 int curlTab = MMget(m, 0);
470 if (curlTab == NIL || ioption == NIL)
476 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
477 if (curlObject == NULL)
483 ioption = MTOI(ioption);
484 std::string value = MMstartstr(m, MTOP(ivalue));
486 curlObject->SetOption((CURLoption)ioption, value);
489 MMechostr(MSKDEBUG,
"ok\n");
505 MMechostr(MSKDEBUG,
"_ADDcurlFormField\n");
508 int ivalue = MMpull(m);
509 int iname = MMpull(m);
510 int curlTab = MMget(m, 0);
511 if (curlTab == NIL || iname == NIL)
517 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
518 if (curlObject == NULL)
524 std::string name = MMstartstr(m, MTOP(iname));
525 std::string value = MMstartstr(m, MTOP(ivalue));
527 curlObject->AddFormField(name, value,
false);
530 MMechostr(MSKDEBUG,
"ok\n");
546 MMechostr(MSKDEBUG,
"_ADDcurlFileFormField\n");
549 int ivalue = MMpull(m);
550 int iname = MMpull(m);
551 int curlTab = MMget(m, 0);
552 if (curlTab == NIL || iname == NIL)
558 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
559 if (curlObject == NULL)
565 std::string name = MMstartstr(m, MTOP(iname));
566 std::string value = MMstartstr(m, MTOP(ivalue));
568 curlObject->AddFormField(name, value,
true);
571 MMechostr(MSKDEBUG,
"ok\n");
579int getCURLDataCb(mmachine m, SCOL_PTR_TYPE wParam, SCOL_PTR_TYPE lParam)
585 if (OBJbeginreflex(m, OBJCURLSCOL, SCOL_PTR curlObj, SCOL_CURL_DATA_CB))
587 MMechostr(MSKDEBUG,
"ObjCurl callback not found\n");
589 if (curlData->code != -1)
590 OBJdelTH(m, OBJCURLSCOL, wParam);
595 int res = MMmalloc(m, STR_SIZE(curlData->size), TYPEBUF);
602 MMstore(m, res, 0, curlData->size);
603 char* BS = MMstartstr(m, res);
604 memcpy(BS, curlData->data, curlData->size);
605 BS[curlData->size] = 0;
606 MMpush(m, PTOM(res));
608 MMpush(m, ITOM(curlData->code));
611 if (curlData->code != -1)
612 OBJdelTH(m, OBJCURLSCOL, wParam);
615 int k = OBJcallreflex(m, 2 );
630 "CURLOPT_VERBOSE",
"CURLOPT_HEADER",
"CURLOPT_NOPROGRESS",
"CURLOPT_NOSIGNAL",
"CURLOPT_WILDCARDMATCH",
631 "CURLOPT_ERRORBUFFER",
"CURLOPT_FAILONERROR",
"CURLOPT_URL",
"CURLOPT_PROTOCOLS",
"CURLOPT_REDIR_PROTOCOLS",
632 "CURLOPT_PROXY",
"CURLOPT_PROXYPORT",
"CURLOPT_PROXYTYPE",
"CURLOPT_NOPROXY",
"CURLOPT_HTTPPROXYTUNNEL",
633 "CURLOPT_SOCKS5_GSSAPI_SERVICE",
"CURLOPT_SOCKS5_GSSAPI_NEC",
"CURLOPT_INTERFACE",
"CURLOPT_LOCALPORT",
634 "CURLOPT_LOCALPORTRANGE",
"CURLOPT_DNS_CACHE_TIMEOUT",
"CURLOPT_DNS_USE_GLOBAL_CACHE",
"CURLOPT_BUFFERSIZE",
635 "CURLOPT_PORT",
"CURLOPT_TCP_NODELAY",
"CURLOPT_ADDRESS_SCOPE",
"CURLOPT_TCP_KEEPALIVE",
"CURLOPT_TCP_KEEPIDLE",
636 "CURLOPT_TCP_KEEPINTVL",
"CURLOPT_NETRC",
"CURL_NETRC_OPTIONAL",
"CURL_NETRC_IGNORED",
"CURL_NETRC_REQUIRED",
637 "CURLOPT_NETRC_FILE",
"CURLOPT_USERPWD",
"CURLOPT_PROXYUSERPWD",
"CURLOPT_USERNAME",
"CURLOPT_PASSWORD",
"CURLOPT_PROXYUSERNAME",
638 "CURLOPT_PROXYPASSWORD",
"CURLOPT_HTTPAUTH",
"CURLAUTH_BASIC",
"CURLAUTH_DIGEST",
"CURLAUTH_DIGEST_IE",
"CURLAUTH_GSSNEGOTIATE",
639 "CURLAUTH_NTLM",
"CURLAUTH_NTLM_WB",
"CURLAUTH_ANY",
"CURLAUTH_ANYSAFE",
"CURLAUTH_ONLY",
"CURLOPT_TLSAUTH_TYPE",
640 "CURLOPT_TLSAUTH_USERNAME",
"CURLOPT_TLSAUTH_PASSWORD",
"CURLOPT_PROXYAUTH",
"CURLOPT_AUTOREFERER",
"CURLOPT_ACCEPT_ENCODING",
641 "CURLOPT_TRANSFER_ENCODING",
"CURLOPT_FOLLOWLOCATION",
"CURLOPT_UNRESTRICTED_AUTH",
"CURLOPT_MAXREDIRS",
"CURLOPT_POSTREDIR",
642 "CURL_REDIR_POST_301",
"CURL_REDIR_POST_302",
"CURL_REDIR_POST_303",
"CURL_REDIR_POST_ALL",
"CURLOPT_PUT",
"CURLOPT_POST",
643 "CURLOPT_POSTFIELDS",
"CURLOPT_POSTFIELDSIZE",
"CURLOPT_POSTFIELDSIZE_LARGE",
"CURLOPT_COPYPOSTFIELDS",
"CURLOPT_HTTPPOST",
644 "CURLOPT_REFERER",
"CURLOPT_USERAGENT",
"CURLOPT_HTTPHEADER",
"CURLOPT_HTTP200ALIASES",
"CURLOPT_COOKIE",
"CURLOPT_COOKIEFILE",
645 "CURLOPT_COOKIEJAR",
"CURLOPT_COOKIESESSION",
"CURLOPT_COOKIELIST",
"CURLOPT_HTTPGET",
"CURLOPT_HTTP_VERSION",
"CURL_HTTP_VERSION_NONE",
646 "CURL_HTTP_VERSION_1_0",
"CURL_HTTP_VERSION_1_1",
"CURLOPT_IGNORE_CONTENT_LENGTH",
"CURLOPT_HTTP_CONTENT_DECODING",
"CURLOPT_HTTP_TRANSFER_DECODING",
647 "CURLOPT_MAIL_FROM",
"CURLOPT_MAIL_RCPT",
"CURLOPT_MAIL_AUTH",
"CURLOPT_TFTP_BLKSIZE",
"CURLOPT_FTPPORT",
"CURLOPT_QUOTE",
"CURLOPT_POSTQUOTE",
648 "CURLOPT_PREQUOTE",
"CURLOPT_DIRLISTONLY",
"CURLOPT_APPEND",
"CURLOPT_FTP_USE_EPRT",
"CURLOPT_FTP_USE_EPSV",
"CURLOPT_FTP_USE_PRET",
"CURLOPT_FTP_CREATE_MISSING_DIRS",
649 "CURLOPT_FTP_RESPONSE_TIMEOUT",
"CURLOPT_FTP_ALTERNATIVE_TO_USER",
"CURLOPT_FTP_SKIP_PASV_IP",
"CURLOPT_FTPSSLAUTH",
"CURLFTPAUTH_DEFAULT",
650 "CURLFTPAUTH_SSL",
"CURLFTPAUTH_TLS",
"CURLOPT_FTP_SSL_CCC",
"CURLFTPSSL_CCC_NONE",
"CURLFTPSSL_CCC_PASSIVE",
"CURLFTPSSL_CCC_ACTIVE",
651 "CURLOPT_FTP_ACCOUNT",
"CURLOPT_FTP_FILEMETHOD",
"CURLFTPMETHOD_MULTICWD",
"CURLFTPMETHOD_NOCWD",
"CURLFTPMETHOD_SINGLECWD",
"CURLOPT_RTSP_REQUEST",
652 "CURL_RTSPREQ_OPTIONS",
"CURL_RTSPREQ_DESCRIBE",
"CURL_RTSPREQ_ANNOUNCE",
"CURL_RTSPREQ_SETUP",
"CURL_RTSPREQ_PLAY",
"CURL_RTSPREQ_PAUSE",
"CURL_RTSPREQ_TEARDOWN",
653 "CURL_RTSPREQ_GET_PARAMETER",
"CURL_RTSPREQ_SET_PARAMETER",
"CURL_RTSPREQ_RECORD",
"CURL_RTSPREQ_RECEIVE",
"CURLOPT_RTSP_SESSION_ID",
654 "CURLOPT_RTSP_STREAM_URI",
"CURLOPT_RTSP_TRANSPORT",
"CURLOPT_RTSP_CLIENT_CSEQ",
"CURLOPT_RTSP_SERVER_CSEQ",
655 "CURLOPT_TRANSFERTEXT",
"CURLOPT_PROXY_TRANSFER_MODE",
"CURLOPT_CRLF",
"CURLOPT_RANGE",
"CURLOPT_RESUME_FROM",
"CURLOPT_RESUME_FROM_LARGE",
656 "CURLOPT_CUSTOMREQUEST",
"CURLOPT_FILETIME",
"CURLOPT_NOBODY",
"CURLOPT_INFILESIZE",
"CURLOPT_INFILESIZE_LARGE",
"CURLOPT_UPLOAD",
657 "CURLOPT_MAXFILESIZE",
"CURLOPT_MAXFILESIZE_LARGE",
"CURLOPT_TIMECONDITION",
"CURLOPT_TIMEVALUE",
"CURLOPT_TIMEOUT",
"CURLOPT_TIMEOUT_MS",
658 "CURLOPT_LOW_SPEED_LIMIT",
"CURLOPT_LOW_SPEED_TIME",
"CURLOPT_MAX_SEND_SPEED_LARGE",
"CURLOPT_MAX_RECV_SPEED_LARGE",
"CURLOPT_MAXCONNECTS",
659 "CURLOPT_CLOSEPOLICY",
"CURLOPT_FRESH_CONNECT",
"CURLOPT_FORBID_REUSE",
"CURLOPT_CONNECTTIMEOUT",
"CURLOPT_CONNECTTIMEOUT_MS",
660 "CURLOPT_IPRESOLVE",
"CURL_IPRESOLVE_WHATEVER",
"CURL_IPRESOLVE_V4",
"CURL_IPRESOLVE_V6",
"CURLOPT_CONNECT_ONLY",
"CURLOPT_USE_SSL",
661 "CURLUSESSL_NONE",
"CURLUSESSL_TRY",
"CURLUSESSL_CONTROL",
"CURLUSESSL_ALL",
"CURLOPT_RESOLVE",
"CURLOPT_DNS_SERVERS",
662 "CURLOPT_ACCEPTTIMEOUT_MS",
"CURLOPT_SSLCERT",
"CURLOPT_SSLCERTTYPE",
"CURLOPT_SSLKEY",
"CURLOPT_SSLKEYTYPE",
"CURLOPT_KEYPASSWD",
663 "CURLOPT_SSLENGINE",
"CURLOPT_SSLENGINE_DEFAULT",
"CURLOPT_SSLVERSION",
"CURL_SSLVERSION_DEFAULT",
"CURL_SSLVERSION_TLSv1",
"CURL_SSLVERSION_SSLv2",
664 "CURL_SSLVERSION_SSLv3",
"CURLOPT_SSL_VERIFYPEER",
"CURLOPT_CAINFO",
"CURLOPT_ISSUERCERT",
"CURLOPT_CAPATH",
"CURLOPT_CRLFILE",
"CURLOPT_SSL_VERIFYHOST",
665 "CURLOPT_CERTINFO",
"CURLOPT_RANDOM_FILE",
"CURLOPT_EGDSOCKET",
"CURLOPT_SSL_CIPHER_LIST",
"CURLOPT_SSL_SESSIONID_CACHE",
"CURLOPT_SSL_OPTIONS",
666 "CURLSSLOPT_ALLOW_BEAST",
"CURLOPT_KRBLEVEL",
"CURLOPT_GSSAPI_DELEGATION",
"CURLOPT_SSH_AUTH_TYPES",
"CURLSSH_AUTH_PUBLICKEY",
"CURLSSH_AUTH_PASSWORD",
667 "CURLSSH_AUTH_HOST",
"CURLSSH_AUTH_KEYBOARD",
"CURLSSH_AUTH_ANY",
"CURLOPT_SSH_HOST_PUBLIC_KEY_MD5",
"CURLOPT_SSH_PUBLIC_KEYFILE",
668 "CURLOPT_SSH_PRIVATE_KEYFILE",
"CURLOPT_SSH_KNOWNHOSTS",
"CURLOPT_NEW_FILE_PERMS",
"CURLOPT_NEW_DIRECTORY_PERMS",
"CURLOPT_TELNETOPTIONS",
673 "_CALLcurlRequestSync",
674 "_SETcurlRequestHeader",
676 "_SETcurlOptionList",
678 "_SETcurlOptionFile",
680 "_ADDcurlFileFormField"
686#define NCURLPKG (sizeof(mCURLname)/sizeof(char*))
691int (*mCURLfun[NCURLPKG])(mmachine m)=
696 SCOL_TYPTYPE(CURLOPT_VERBOSE), SCOL_TYPTYPE(CURLOPT_HEADER), SCOL_TYPTYPE(CURLOPT_NOPROGRESS), SCOL_TYPTYPE(CURLOPT_NOSIGNAL), SCOL_TYPTYPE(CURLOPT_WILDCARDMATCH),
697 SCOL_TYPTYPE(CURLOPT_ERRORBUFFER), SCOL_TYPTYPE(CURLOPT_FAILONERROR), SCOL_TYPTYPE(CURLOPT_URL), SCOL_TYPTYPE(CURLOPT_PROTOCOLS), SCOL_TYPTYPE(CURLOPT_REDIR_PROTOCOLS),
698 SCOL_TYPTYPE(CURLOPT_PROXY), SCOL_TYPTYPE(CURLOPT_PROXYPORT), SCOL_TYPTYPE(CURLOPT_PROXYTYPE), SCOL_TYPTYPE(CURLOPT_NOPROXY), SCOL_TYPTYPE(CURLOPT_HTTPPROXYTUNNEL),
699 SCOL_TYPTYPE(CURLOPT_SOCKS5_GSSAPI_SERVICE), SCOL_TYPTYPE(CURLOPT_SOCKS5_GSSAPI_NEC), SCOL_TYPTYPE(CURLOPT_INTERFACE), SCOL_TYPTYPE(CURLOPT_LOCALPORT),
700 SCOL_TYPTYPE(CURLOPT_LOCALPORTRANGE), SCOL_TYPTYPE(CURLOPT_DNS_CACHE_TIMEOUT), SCOL_TYPTYPE(CURLOPT_DNS_USE_GLOBAL_CACHE), SCOL_TYPTYPE(CURLOPT_BUFFERSIZE),
701 SCOL_TYPTYPE(CURLOPT_PORT), SCOL_TYPTYPE(CURLOPT_TCP_NODELAY), SCOL_TYPTYPE(CURLOPT_ADDRESS_SCOPE), SCOL_TYPTYPE(CURLOPT_TCP_KEEPALIVE), SCOL_TYPTYPE(CURLOPT_TCP_KEEPIDLE),
702 SCOL_TYPTYPE(CURLOPT_TCP_KEEPINTVL), SCOL_TYPTYPE(CURLOPT_NETRC), SCOL_TYPTYPE(CURL_NETRC_OPTIONAL), SCOL_TYPTYPE(CURL_NETRC_IGNORED), SCOL_TYPTYPE(CURL_NETRC_REQUIRED),
703 SCOL_TYPTYPE(CURLOPT_NETRC_FILE), SCOL_TYPTYPE(CURLOPT_USERPWD), SCOL_TYPTYPE(CURLOPT_PROXYUSERPWD), SCOL_TYPTYPE(CURLOPT_USERNAME), SCOL_TYPTYPE(CURLOPT_PASSWORD), SCOL_TYPTYPE(CURLOPT_PROXYUSERNAME),
704 SCOL_TYPTYPE(CURLOPT_PROXYPASSWORD), SCOL_TYPTYPE(CURLOPT_HTTPAUTH), SCOL_TYPTYPE(CURLAUTH_BASIC), SCOL_TYPTYPE(CURLAUTH_DIGEST), SCOL_TYPTYPE(CURLAUTH_DIGEST_IE), SCOL_TYPTYPE(CURLAUTH_GSSNEGOTIATE),
705 SCOL_TYPTYPE(CURLAUTH_NTLM), SCOL_TYPTYPE(CURLAUTH_NTLM_WB), SCOL_TYPTYPE(CURLAUTH_ANY), SCOL_TYPTYPE(CURLAUTH_ANYSAFE), SCOL_TYPTYPE(CURLAUTH_ONLY), SCOL_TYPTYPE(CURLOPT_TLSAUTH_TYPE),
706 SCOL_TYPTYPE(CURLOPT_TLSAUTH_USERNAME), SCOL_TYPTYPE(CURLOPT_TLSAUTH_PASSWORD), SCOL_TYPTYPE(CURLOPT_PROXYAUTH), SCOL_TYPTYPE(CURLOPT_AUTOREFERER), SCOL_TYPTYPE(CURLOPT_ACCEPT_ENCODING),
707 SCOL_TYPTYPE(CURLOPT_TRANSFER_ENCODING), SCOL_TYPTYPE(CURLOPT_FOLLOWLOCATION), SCOL_TYPTYPE(CURLOPT_UNRESTRICTED_AUTH), SCOL_TYPTYPE(CURLOPT_MAXREDIRS), SCOL_TYPTYPE(CURLOPT_POSTREDIR),
708 SCOL_TYPTYPE(CURL_REDIR_POST_301), SCOL_TYPTYPE(CURL_REDIR_POST_302), SCOL_TYPTYPE(CURL_REDIR_POST_303), SCOL_TYPTYPE(CURL_REDIR_POST_ALL), SCOL_TYPTYPE(CURLOPT_PUT), SCOL_TYPTYPE(CURLOPT_POST),
709 SCOL_TYPTYPE(CURLOPT_POSTFIELDS), SCOL_TYPTYPE(CURLOPT_POSTFIELDSIZE), SCOL_TYPTYPE(CURLOPT_POSTFIELDSIZE_LARGE), SCOL_TYPTYPE(CURLOPT_COPYPOSTFIELDS), SCOL_TYPTYPE(CURLOPT_HTTPPOST),
710 SCOL_TYPTYPE(CURLOPT_REFERER), SCOL_TYPTYPE(CURLOPT_USERAGENT), SCOL_TYPTYPE(CURLOPT_HTTPHEADER), SCOL_TYPTYPE(CURLOPT_HTTP200ALIASES), SCOL_TYPTYPE(CURLOPT_COOKIE), SCOL_TYPTYPE(CURLOPT_COOKIEFILE),
711 SCOL_TYPTYPE(CURLOPT_COOKIEJAR), SCOL_TYPTYPE(CURLOPT_COOKIESESSION), SCOL_TYPTYPE(CURLOPT_COOKIELIST), SCOL_TYPTYPE(CURLOPT_HTTPGET), SCOL_TYPTYPE(CURLOPT_HTTP_VERSION), SCOL_TYPTYPE(CURL_HTTP_VERSION_NONE),
712 SCOL_TYPTYPE(CURL_HTTP_VERSION_1_0), SCOL_TYPTYPE(CURL_HTTP_VERSION_1_1), SCOL_TYPTYPE(CURLOPT_IGNORE_CONTENT_LENGTH), SCOL_TYPTYPE(CURLOPT_HTTP_CONTENT_DECODING), SCOL_TYPTYPE(CURLOPT_HTTP_TRANSFER_DECODING),
713 SCOL_TYPTYPE(CURLOPT_MAIL_FROM), SCOL_TYPTYPE(CURLOPT_MAIL_RCPT), SCOL_TYPTYPE(CURLOPT_MAIL_AUTH), SCOL_TYPTYPE(CURLOPT_TFTP_BLKSIZE), SCOL_TYPTYPE(CURLOPT_FTPPORT), SCOL_TYPTYPE(CURLOPT_QUOTE), SCOL_TYPTYPE(CURLOPT_POSTQUOTE),
714 SCOL_TYPTYPE(CURLOPT_PREQUOTE), SCOL_TYPTYPE(CURLOPT_DIRLISTONLY), SCOL_TYPTYPE(CURLOPT_APPEND), SCOL_TYPTYPE(CURLOPT_FTP_USE_EPRT), SCOL_TYPTYPE(CURLOPT_FTP_USE_EPSV), SCOL_TYPTYPE(CURLOPT_FTP_USE_PRET), SCOL_TYPTYPE(CURLOPT_FTP_CREATE_MISSING_DIRS),
715 SCOL_TYPTYPE(CURLOPT_FTP_RESPONSE_TIMEOUT), SCOL_TYPTYPE(CURLOPT_FTP_ALTERNATIVE_TO_USER), SCOL_TYPTYPE(CURLOPT_FTP_SKIP_PASV_IP), SCOL_TYPTYPE(CURLOPT_FTPSSLAUTH), SCOL_TYPTYPE(CURLFTPAUTH_DEFAULT),
716 SCOL_TYPTYPE(CURLFTPAUTH_SSL), SCOL_TYPTYPE(CURLFTPAUTH_TLS), SCOL_TYPTYPE(CURLOPT_FTP_SSL_CCC), SCOL_TYPTYPE(CURLFTPSSL_CCC_NONE), SCOL_TYPTYPE(CURLFTPSSL_CCC_PASSIVE), SCOL_TYPTYPE(CURLFTPSSL_CCC_ACTIVE),
717 SCOL_TYPTYPE(CURLOPT_FTP_ACCOUNT), SCOL_TYPTYPE(CURLOPT_FTP_FILEMETHOD), SCOL_TYPTYPE(CURLFTPMETHOD_MULTICWD), SCOL_TYPTYPE(CURLFTPMETHOD_NOCWD), SCOL_TYPTYPE(CURLFTPMETHOD_SINGLECWD), SCOL_TYPTYPE(CURLOPT_RTSP_REQUEST),
718 SCOL_TYPTYPE(CURL_RTSPREQ_OPTIONS), SCOL_TYPTYPE(CURL_RTSPREQ_DESCRIBE), SCOL_TYPTYPE(CURL_RTSPREQ_ANNOUNCE), SCOL_TYPTYPE(CURL_RTSPREQ_SETUP), SCOL_TYPTYPE(CURL_RTSPREQ_PLAY), SCOL_TYPTYPE(CURL_RTSPREQ_PAUSE), SCOL_TYPTYPE(CURL_RTSPREQ_TEARDOWN),
719 SCOL_TYPTYPE(CURL_RTSPREQ_GET_PARAMETER), SCOL_TYPTYPE(CURL_RTSPREQ_SET_PARAMETER), SCOL_TYPTYPE(CURL_RTSPREQ_RECORD), SCOL_TYPTYPE(CURL_RTSPREQ_RECEIVE), SCOL_TYPTYPE(CURLOPT_RTSP_SESSION_ID),
720 SCOL_TYPTYPE(CURLOPT_RTSP_STREAM_URI), SCOL_TYPTYPE(CURLOPT_RTSP_TRANSPORT), SCOL_TYPTYPE(CURLOPT_RTSP_CLIENT_CSEQ), SCOL_TYPTYPE(CURLOPT_RTSP_SERVER_CSEQ),
721 SCOL_TYPTYPE(CURLOPT_TRANSFERTEXT), SCOL_TYPTYPE(CURLOPT_PROXY_TRANSFER_MODE), SCOL_TYPTYPE(CURLOPT_CRLF), SCOL_TYPTYPE(CURLOPT_RANGE), SCOL_TYPTYPE(CURLOPT_RESUME_FROM), SCOL_TYPTYPE(CURLOPT_RESUME_FROM_LARGE),
722 SCOL_TYPTYPE(CURLOPT_CUSTOMREQUEST), SCOL_TYPTYPE(CURLOPT_FILETIME), SCOL_TYPTYPE(CURLOPT_NOBODY), SCOL_TYPTYPE(CURLOPT_INFILESIZE), SCOL_TYPTYPE(CURLOPT_INFILESIZE_LARGE), SCOL_TYPTYPE(CURLOPT_UPLOAD),
723 SCOL_TYPTYPE(CURLOPT_MAXFILESIZE), SCOL_TYPTYPE(CURLOPT_MAXFILESIZE_LARGE), SCOL_TYPTYPE(CURLOPT_TIMECONDITION), SCOL_TYPTYPE(CURLOPT_TIMEVALUE), SCOL_TYPTYPE(CURLOPT_TIMEOUT), SCOL_TYPTYPE(CURLOPT_TIMEOUT_MS),
724 SCOL_TYPTYPE(CURLOPT_LOW_SPEED_LIMIT), SCOL_TYPTYPE(CURLOPT_LOW_SPEED_TIME), SCOL_TYPTYPE(CURLOPT_MAX_SEND_SPEED_LARGE), SCOL_TYPTYPE(CURLOPT_MAX_RECV_SPEED_LARGE), SCOL_TYPTYPE(CURLOPT_MAXCONNECTS),
725 SCOL_TYPTYPE(CURLOPT_CLOSEPOLICY), SCOL_TYPTYPE(CURLOPT_FRESH_CONNECT), SCOL_TYPTYPE(CURLOPT_FORBID_REUSE), SCOL_TYPTYPE(CURLOPT_CONNECTTIMEOUT), SCOL_TYPTYPE(CURLOPT_CONNECTTIMEOUT_MS),
726 SCOL_TYPTYPE(CURLOPT_IPRESOLVE), SCOL_TYPTYPE(CURL_IPRESOLVE_WHATEVER), SCOL_TYPTYPE(CURL_IPRESOLVE_V4), SCOL_TYPTYPE(CURL_IPRESOLVE_V6), SCOL_TYPTYPE(CURLOPT_CONNECT_ONLY), SCOL_TYPTYPE(CURLOPT_USE_SSL),
727 SCOL_TYPTYPE(CURLUSESSL_NONE), SCOL_TYPTYPE(CURLUSESSL_TRY), SCOL_TYPTYPE(CURLUSESSL_CONTROL), SCOL_TYPTYPE(CURLUSESSL_ALL), SCOL_TYPTYPE(CURLOPT_RESOLVE), SCOL_TYPTYPE(CURLOPT_DNS_SERVERS),
728 SCOL_TYPTYPE(CURLOPT_ACCEPTTIMEOUT_MS), SCOL_TYPTYPE(CURLOPT_SSLCERT), SCOL_TYPTYPE(CURLOPT_SSLCERTTYPE), SCOL_TYPTYPE(CURLOPT_SSLKEY), SCOL_TYPTYPE(CURLOPT_SSLKEYTYPE), SCOL_TYPTYPE(CURLOPT_KEYPASSWD),
729 SCOL_TYPTYPE(CURLOPT_SSLENGINE), SCOL_TYPTYPE(CURLOPT_SSLENGINE_DEFAULT), SCOL_TYPTYPE(CURLOPT_SSLVERSION), SCOL_TYPTYPE(CURL_SSLVERSION_DEFAULT), SCOL_TYPTYPE(CURL_SSLVERSION_TLSv1), SCOL_TYPTYPE(CURL_SSLVERSION_SSLv2),
730 SCOL_TYPTYPE(CURL_SSLVERSION_SSLv3), SCOL_TYPTYPE(CURLOPT_SSL_VERIFYPEER), SCOL_TYPTYPE(CURLOPT_CAINFO), SCOL_TYPTYPE(CURLOPT_ISSUERCERT), SCOL_TYPTYPE(CURLOPT_CAPATH), SCOL_TYPTYPE(CURLOPT_CRLFILE), SCOL_TYPTYPE(CURLOPT_SSL_VERIFYHOST),
731 SCOL_TYPTYPE(CURLOPT_CERTINFO), SCOL_TYPTYPE(CURLOPT_RANDOM_FILE), SCOL_TYPTYPE(CURLOPT_EGDSOCKET), SCOL_TYPTYPE(CURLOPT_SSL_CIPHER_LIST), SCOL_TYPTYPE(CURLOPT_SSL_SESSIONID_CACHE), SCOL_TYPTYPE(CURLOPT_SSL_OPTIONS),
732 SCOL_TYPTYPE(CURLSSLOPT_ALLOW_BEAST), SCOL_TYPTYPE(CURLOPT_KRBLEVEL), SCOL_TYPTYPE(CURLOPT_GSSAPI_DELEGATION), SCOL_TYPTYPE(CURLOPT_SSH_AUTH_TYPES), SCOL_TYPTYPE(CURLSSH_AUTH_PUBLICKEY), SCOL_TYPTYPE(CURLSSH_AUTH_PASSWORD),
733 SCOL_TYPTYPE(CURLSSH_AUTH_HOST), SCOL_TYPTYPE(CURLSSH_AUTH_KEYBOARD), SCOL_TYPTYPE(CURLSSH_AUTH_ANY), SCOL_TYPTYPE(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5), SCOL_TYPTYPE(CURLOPT_SSH_PUBLIC_KEYFILE),
734 SCOL_TYPTYPE(CURLOPT_SSH_PRIVATE_KEYFILE), SCOL_TYPTYPE(CURLOPT_SSH_KNOWNHOSTS), SCOL_TYPTYPE(CURLOPT_NEW_FILE_PERMS), SCOL_TYPTYPE(CURLOPT_NEW_DIRECTORY_PERMS), SCOL_TYPTYPE(CURLOPT_TELNETOPTIONS),
752int mCURLnarg[NCURLPKG]=
757 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
758 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
759 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
760 TYPVAR, TYPVAR, TYPVAR, TYPVAR,
761 TYPVAR, TYPVAR, TYPVAR, TYPVAR,
762 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
763 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
764 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
765 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
766 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
767 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
768 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
769 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
770 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
771 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
772 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
773 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
774 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
775 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
776 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
777 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
778 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
779 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
780 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
781 TYPVAR, TYPVAR, TYPVAR, TYPVAR,
782 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
783 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
784 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
785 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
786 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
787 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
788 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
789 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
790 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
791 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
792 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
793 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
794 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
795 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
813char* mCURLtype[NCURLPKG]=
818 "I",
"I",
"I",
"I",
"I",
819 "I",
"I",
"I",
"I",
"I",
820 "I",
"I",
"I",
"I",
"I",
823 "I",
"I",
"I",
"I",
"I",
824 "I",
"I",
"I",
"I",
"I",
825 "I",
"I",
"I",
"I",
"I",
"I",
826 "I",
"I",
"I",
"I",
"I",
"I",
827 "I",
"I",
"I",
"I",
"I",
"I",
828 "I",
"I",
"I",
"I",
"I",
829 "I",
"I",
"I",
"I",
"I",
830 "I",
"I",
"I",
"I",
"I",
"I",
831 "I",
"I",
"I",
"I",
"I",
832 "I",
"I",
"I",
"I",
"I",
"I",
833 "I",
"I",
"I",
"I",
"I",
"I",
834 "I",
"I",
"I",
"I",
"I",
835 "I",
"I",
"I",
"I",
"I",
"I",
"I",
836 "I",
"I",
"I",
"I",
"I",
"I",
"I",
837 "I",
"I",
"I",
"I",
"I",
838 "I",
"I",
"I",
"I",
"I",
"I",
839 "I",
"I",
"I",
"I",
"I",
"I",
840 "I",
"I",
"I",
"I",
"I",
"I",
"I",
841 "I",
"I",
"I",
"I",
"I",
843 "I",
"I",
"I",
"I",
"I",
"I",
844 "I",
"I",
"I",
"I",
"I",
"I",
845 "I",
"I",
"I",
"I",
"I",
"I",
846 "I",
"I",
"I",
"I",
"I",
847 "I",
"I",
"I",
"I",
"I",
848 "I",
"I",
"I",
"I",
"I",
"I",
849 "I",
"I",
"I",
"I",
"I",
"I",
850 "I",
"I",
"I",
"I",
"I",
"I",
851 "I",
"I",
"I",
"I",
"I",
"I",
852 "I",
"I",
"I",
"I",
"I",
"I",
"I",
853 "I",
"I",
"I",
"I",
"I",
"I",
854 "I",
"I",
"I",
"I",
"I",
"I",
855 "I",
"I",
"I",
"I",
"I",
856 "I",
"I",
"I",
"I",
"I",
858 "fun [Chn S] ObjCURL",
860 "fun [ObjCURL fun [ObjCURL u0 S I] u1 u0] ObjCURL",
861 "fun [ObjCURL fun [ObjCURL u0 S I] u1 u0] ObjCURL",
862 "fun [ObjCURL [S r1]] ObjCURL",
863 "fun [ObjCURL I I] ObjCURL",
864 "fun [ObjCURL I [S r1]] ObjCURL",
865 "fun [ObjCURL I S] ObjCURL",
866 "fun [ObjCURL I P] ObjCURL",
867 "fun [ObjCURL S S] ObjCURL",
868 "fun [ObjCURL S P] ObjCURL"
879int LoadCurl(mmachine m)
884 curl_global_init(CURL_GLOBAL_SSL);
887 SService::GetInstance();
889 MMechostr(MSKDEBUG,
"\n" );
890 MMechostr(MSKDEBUG,
" > Loading CURL Support\n");
893 OBJCURLSCOL = OBJregister(1 , 1, destroyCurlObj,
"OBJCURLSCOL");
894 k = PKhardpak(m,
"mCURL.pkg-1.0", NCURLPKG, mCURLname, mCURLfun, mCURLnarg, mCURLtype);
897 CURL_DATA_CB = OBJgetUserEvent();
898 OBJdefEvent(CURL_DATA_CB, getCURLDataCb);
900 MMechostr(MSKDEBUG,
" > Successfully Loaded\n\n");
906 MMechostr(MSKDEBUG,
"\n" );
907 MMechostr(MSKDEBUG,
" > Unloading CURL Support\n");
910 SService::GetInstance()->Kill();
913 curl_global_cleanup();
915 MMechostr(MSKDEBUG,
" > Successfully unloaded\n\n");
927extern "C" SCOL_EXPORT
int ScolLoadPlugin(mmachine m, cbmachine w)
937extern "C" SCOL_EXPORT
int ScolUnloadPlugin()
946extern "C" SCOL_EXPORT
int ScolScurlLoadPlugin(mmachine m, cbmachine w)
956extern "C" SCOL_EXPORT
int ScolScurlUnloadPlugin()
int _CALLcurlRequestSync(mmachine m)
_CALLcurlRequestSync : This function execute the CURL object request and block until the request is f...
int _CALLcurlRequest(mmachine m)
_CALLcurlRequest : This function execute the CURL object request asynchronously Prototype: fun [ObjCU...
int _SETcurlRequestHeader(mmachine m)
_SETcurlRequestHeader : This function change the CURL request header content Prototype: fun [ObjCURL ...
int _SETcurlOptionList(mmachine m)
_SETcurlOptionList : This function set CURL options with a list param Prototype: fun [ObjCURL I [S r1...
int _SETcurlOptionFile(mmachine m)
_SETcurlOptionFile : This function set CURL options with a file Prototype: fun [ObjCURL I P] ObjCURL
int _SETcurlOptionS(mmachine m)
_SETcurlOptionS : This function set CURL options with a string Prototype: fun [ObjCURL I S] ObjCURL
int _SETcurlOption(mmachine m)
_SETcurlOption : This function set CURL options Prototype: fun [ObjCURL I I] ObjCURL
int _CRcurlRequest(mmachine m)
_CRcurlRequest : This function create a CURL object
int _KILLcurlRequest(mmachine m)
_KILLcurlRequest : Destroy CURL object
int _ADDcurlFileFormField(mmachine m)
_ADDcurlFileFormField : This function add a file form field for Post operation on a CURL object Proto...
int _ADDcurlFormField(mmachine m)
_ADDcurlFormField : This function add a form field for Post operation on a CURL object Prototype: fun...