[GB.NET.CURL]

* NEW: Curl.ErrorText is a new property that returns the error string 
  associated with the error code returned by the curl library. If 
  Curl.Status is positive, then a null string is returned.
* BUG: Disable error code constants for unsupported curl features.


git-svn-id: svn://localhost/gambas/trunk@4084 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2011-09-04 13:39:33 +00:00
parent de28acb52b
commit 06aab3aa0a
2 changed files with 23 additions and 13 deletions

View file

@ -408,12 +408,21 @@ END_PROPERTY
/*********************************************
Status : inactive, working or Error code
*********************************************/
BEGIN_PROPERTY ( CCURL_Status )
BEGIN_PROPERTY(CCURL_Status)
GB.ReturnInteger(THIS_STATUS);
END_PROPERTY
BEGIN_PROPERTY(Curl_ErrorText)
if (THIS_STATUS >= 0)
GB.ReturnNull();
else
GB.ReturnConstZeroString(curl_easy_strerror((-THIS_STATUS) - 1000));
END_PROPERTY
/*****************************************************************
URL to work with
*****************************************************************/
@ -579,6 +588,7 @@ GB_DESC CCurlDesc[] =
GB_PROPERTY("Timeout","i",CCURL_TimeOut),
GB_PROPERTY_SELF("Proxy",".Curl.Proxy"),
GB_PROPERTY_READ("Status","i",CCURL_Status),
GB_PROPERTY_READ("ErrorText", "s", Curl_ErrorText),
GB_PROPERTY("Debug", "b", Curl_Debug),
GB_END_DECLARE

View file

@ -94,15 +94,15 @@ GB_DESC CNetDesc[] =
GB_CONSTANT("SSLConnectError", "i", GBCURL(CURLE_SSL_CONNECT_ERROR)),
GB_CONSTANT("BadDownloadResume", "i", GBCURL(CURLE_BAD_DOWNLOAD_RESUME)),
GB_CONSTANT("FileUnableToReadFile", "i", GBCURL(CURLE_FILE_COULDNT_READ_FILE)),
GB_CONSTANT("LDAPCannotBind", "i", GBCURL(CURLE_LDAP_CANNOT_BIND)),
GB_CONSTANT("LDAPSearchFailed", "i", GBCURL(CURLE_LDAP_SEARCH_FAILED)),
//GB_CONSTANT("LDAPCannotBind", "i", GBCURL(CURLE_LDAP_CANNOT_BIND)),
//GB_CONSTANT("LDAPSearchFailed", "i", GBCURL(CURLE_LDAP_SEARCH_FAILED)),
GB_CONSTANT("FunctionNotFound", "i", GBCURL(CURLE_FUNCTION_NOT_FOUND)),
GB_CONSTANT("AbortedByCallback", "i", GBCURL(CURLE_ABORTED_BY_CALLBACK)),
GB_CONSTANT("BadFunctionArgument", "i", GBCURL(CURLE_BAD_FUNCTION_ARGUMENT)),
GB_CONSTANT("InterfaceFailed", "i", GBCURL(CURLE_INTERFACE_FAILED)),
GB_CONSTANT("TooManyRedirects", "i", GBCURL(CURLE_TOO_MANY_REDIRECTS )),
GB_CONSTANT("UnknownTelnetOption", "i", GBCURL(CURLE_UNKNOWN_TELNET_OPTION)),
GB_CONSTANT("TelnetOptionSyntax", "i", GBCURL(CURLE_TELNET_OPTION_SYNTAX)),
//GB_CONSTANT("UnknownTelnetOption", "i", GBCURL(CURLE_UNKNOWN_TELNET_OPTION)),
//GB_CONSTANT("TelnetOptionSyntax", "i", GBCURL(CURLE_TELNET_OPTION_SYNTAX)),
GB_CONSTANT("PeerFailedVerification", "i", GBCURL(CURLE_PEER_FAILED_VERIFICATION)),
GB_CONSTANT("GotNothing", "i", GBCURL(CURLE_GOT_NOTHING)),
GB_CONSTANT("SSLEngineNotFound", "i", GBCURL(CURLE_SSL_ENGINE_NOTFOUND)),
@ -113,19 +113,19 @@ GB_DESC CNetDesc[] =
GB_CONSTANT("SSLCipher", "i", GBCURL(CURLE_SSL_CIPHER)),
GB_CONSTANT("SSLCacert", "i", GBCURL(CURLE_SSL_CACERT)),
GB_CONSTANT("BadContentEncoding", "i", GBCURL(CURLE_BAD_CONTENT_ENCODING)),
GB_CONSTANT("LDAPInvalidURL", "i", GBCURL(CURLE_LDAP_INVALID_URL)),
//GB_CONSTANT("LDAPInvalidURL", "i", GBCURL(CURLE_LDAP_INVALID_URL)),
GB_CONSTANT("FileSizeExceeded", "i", GBCURL(CURLE_FILESIZE_EXCEEDED)),
GB_CONSTANT("UseSSLFailed", "i", GBCURL(CURLE_USE_SSL_FAILED)),
GB_CONSTANT("SendFailRewind", "i", GBCURL(CURLE_SEND_FAIL_REWIND)),
GB_CONSTANT("SSLEngineInitFailed", "i", GBCURL(CURLE_SSL_ENGINE_INITFAILED)),
GB_CONSTANT("LoginDenied", "i", GBCURL(CURLE_LOGIN_DENIED)),
GB_CONSTANT("TFTPNotFound", "i", GBCURL(CURLE_TFTP_NOTFOUND)),
GB_CONSTANT("TFTPPerm", "i", GBCURL(CURLE_TFTP_PERM)),
//GB_CONSTANT("TFTPNotFound", "i", GBCURL(CURLE_TFTP_NOTFOUND)),
//GB_CONSTANT("TFTPPerm", "i", GBCURL(CURLE_TFTP_PERM)),
GB_CONSTANT("RemoteDiskFull", "i", GBCURL(CURLE_REMOTE_DISK_FULL)),
GB_CONSTANT("TFTPIllegal", "i", GBCURL(CURLE_TFTP_ILLEGAL)),
GB_CONSTANT("TFTPUnknownID", "i", GBCURL(CURLE_TFTP_UNKNOWNID)),
//GB_CONSTANT("TFTPIllegal", "i", GBCURL(CURLE_TFTP_ILLEGAL)),
//GB_CONSTANT("TFTPUnknownID", "i", GBCURL(CURLE_TFTP_UNKNOWNID)),
GB_CONSTANT("RemoteFileExists", "i", GBCURL(CURLE_REMOTE_FILE_EXISTS)),
GB_CONSTANT("TFTPNoSuchUser", "i", GBCURL(CURLE_TFTP_NOSUCHUSER)),
//GB_CONSTANT("TFTPNoSuchUser", "i", GBCURL(CURLE_TFTP_NOSUCHUSER)),
GB_CONSTANT("ConvFailed", "i", GBCURL(CURLE_CONV_FAILED)),
GB_CONSTANT("ConvRequired", "i", GBCURL(CURLE_CONV_REQD)),
GB_CONSTANT("SSLCacertBadFile", "i", GBCURL(CURLE_SSL_CACERT_BADFILE)),
@ -136,8 +136,8 @@ GB_DESC CNetDesc[] =
GB_CONSTANT("SSLCrlBadfile", "i", GBCURL(CURLE_SSL_CRL_BADFILE)),
GB_CONSTANT("SSLIssuerError", "i", GBCURL(CURLE_SSL_ISSUER_ERROR)),
GB_CONSTANT("FTPPretFailed", "i", GBCURL(CURLE_FTP_PRET_FAILED)),
GB_CONSTANT("RTSPCSeqError", "i", GBCURL(CURLE_RTSP_CSEQ_ERROR)),
GB_CONSTANT("RTSPSessionError", "i", GBCURL(CURLE_RTSP_SESSION_ERROR)),
//GB_CONSTANT("RTSPCSeqError", "i", GBCURL(CURLE_RTSP_CSEQ_ERROR)),
//GB_CONSTANT("RTSPSessionError", "i", GBCURL(CURLE_RTSP_SESSION_ERROR)),
GB_CONSTANT("FTPBadFileList", "i", GBCURL(CURLE_FTP_BAD_FILE_LIST)),
GB_CONSTANT("ChunkFailed", "i", GBCURL(CURLE_CHUNK_FAILED)),