2004-03-15 06:51:32 -05:00
|
|
|
/***************************************************************************
|
2004-09-19 10:28:16 -04:00
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
2004-03-15 06:51:32 -05:00
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2011-01-19 14:35:02 -05:00
|
|
|
* Copyright (C) 2004 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
2004-03-15 06:51:32 -05:00
|
|
|
*
|
|
|
|
* This software is licensed as described in the file COPYING, which
|
|
|
|
* you should have received as part of this distribution. The terms
|
|
|
|
* are also available at http://curl.haxx.se/docs/copyright.html.
|
2004-09-19 10:28:16 -04:00
|
|
|
*
|
2004-03-15 06:51:32 -05:00
|
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
* copies of the Software, and permit persons to whom the Software is
|
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
|
|
|
|
2004-03-24 17:45:37 -05:00
|
|
|
#include "setup.h"
|
2004-03-25 02:33:11 -05:00
|
|
|
|
2005-05-18 09:24:23 -04:00
|
|
|
#ifdef HAVE_STRERROR_R
|
2009-06-04 15:11:11 -04:00
|
|
|
# if (!defined(HAVE_POSIX_STRERROR_R) && \
|
|
|
|
!defined(HAVE_GLIBC_STRERROR_R) && \
|
|
|
|
!defined(HAVE_VXWORKS_STRERROR_R)) || \
|
|
|
|
(defined(HAVE_POSIX_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)) || \
|
|
|
|
(defined(HAVE_GLIBC_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)) || \
|
|
|
|
(defined(HAVE_POSIX_STRERROR_R) && defined(HAVE_GLIBC_STRERROR_R))
|
|
|
|
# error "strerror_r MUST be either POSIX-style, glibc-style or vxworks-style"
|
2008-09-12 06:51:57 -04:00
|
|
|
# endif
|
|
|
|
#endif
|
2005-05-18 09:24:23 -04:00
|
|
|
|
2004-03-25 02:33:11 -05:00
|
|
|
#include <curl/curl.h>
|
2004-03-24 17:45:37 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
2004-10-02 09:01:44 -04:00
|
|
|
#ifdef USE_LIBIDN
|
|
|
|
#include <idna.h>
|
|
|
|
#endif
|
|
|
|
|
2004-03-25 08:42:23 -05:00
|
|
|
#include "strerror.h"
|
2004-03-24 17:45:37 -05:00
|
|
|
|
|
|
|
#define _MPRINTF_REPLACE /* use our functions only */
|
|
|
|
#include <curl/mprintf.h>
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2004-05-06 06:49:40 -04:00
|
|
|
|
2004-03-15 06:51:32 -05:00
|
|
|
const char *
|
|
|
|
curl_easy_strerror(CURLcode error)
|
|
|
|
{
|
2004-11-11 11:34:24 -05:00
|
|
|
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
2004-03-15 06:51:32 -05:00
|
|
|
switch (error) {
|
|
|
|
case CURLE_OK:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "No error";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_UNSUPPORTED_PROTOCOL:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Unsupported protocol";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_FAILED_INIT:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Failed initialization";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_URL_MALFORMAT:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "URL using bad/illegal format or missing URL";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_COULDNT_RESOLVE_PROXY:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Couldn't resolve proxy name";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_COULDNT_RESOLVE_HOST:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Couldn't resolve host name";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_COULDNT_CONNECT:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Couldn't connect to server";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_FTP_WEIRD_SERVER_REPLY:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "FTP: weird server reply";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2007-08-30 16:34:57 -04:00
|
|
|
case CURLE_REMOTE_ACCESS_DENIED:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Access denied to remote resource";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2010-01-01 09:44:44 -05:00
|
|
|
case CURLE_FTP_PRET_FAILED:
|
|
|
|
return "FTP: The server did not accept the PRET command.";
|
|
|
|
|
2004-03-15 06:51:32 -05:00
|
|
|
case CURLE_FTP_WEIRD_PASS_REPLY:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "FTP: unknown PASS reply";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_FTP_WEIRD_PASV_REPLY:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "FTP: unknown PASV reply";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_FTP_WEIRD_227_FORMAT:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "FTP: unknown 227 response format";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_FTP_CANT_GET_HOST:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "FTP: can't figure out the host in the PASV response";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2007-08-30 16:34:57 -04:00
|
|
|
case CURLE_FTP_COULDNT_SET_TYPE:
|
|
|
|
return "FTP: couldn't set file type";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_PARTIAL_FILE:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "Transferred a partial file";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_FTP_COULDNT_RETR_FILE:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "FTP: couldn't retrieve (RETR failed) the specified file";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2007-08-30 16:34:57 -04:00
|
|
|
case CURLE_QUOTE_ERROR:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Quote command returned error";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2004-04-26 03:12:29 -04:00
|
|
|
case CURLE_HTTP_RETURNED_ERROR:
|
|
|
|
return "HTTP response code said error";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_WRITE_ERROR:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Failed writing received data to disk/application";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2007-05-08 07:34:31 -04:00
|
|
|
case CURLE_UPLOAD_FAILED:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Upload failed (at start/before it took off)";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_READ_ERROR:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Failed to open/read local data from file/application";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_OUT_OF_MEMORY:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Out of memory";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2007-08-30 16:34:57 -04:00
|
|
|
case CURLE_OPERATION_TIMEDOUT:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Timeout was reached";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_FTP_PORT_FAILED:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "FTP: command PORT failed";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_FTP_COULDNT_USE_REST:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "FTP: command REST failed";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2007-08-30 16:34:57 -04:00
|
|
|
case CURLE_RANGE_ERROR:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Requested range was not delivered by the server";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_HTTP_POST_ERROR:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Internal problem setting up the POST";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_SSL_CONNECT_ERROR:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "SSL connect error";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2004-12-11 13:55:23 -05:00
|
|
|
case CURLE_BAD_DOWNLOAD_RESUME:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Couldn't resume download";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_FILE_COULDNT_READ_FILE:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Couldn't read a file:// file";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_LDAP_CANNOT_BIND:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "LDAP: cannot bind";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_LDAP_SEARCH_FAILED:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "LDAP: search failed";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_FUNCTION_NOT_FOUND:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "A required function in the library was not found";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_ABORTED_BY_CALLBACK:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Operation was aborted by an application callback";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_BAD_FUNCTION_ARGUMENT:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "A libcurl function was given a bad argument";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2004-04-26 03:12:29 -04:00
|
|
|
case CURLE_INTERFACE_FAILED:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Failed binding local connection end";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_TOO_MANY_REDIRECTS :
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Number of redirects hit maximum amount";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_UNKNOWN_TELNET_OPTION:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "User specified an unknown telnet option";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_TELNET_OPTION_SYNTAX :
|
|
|
|
return "Malformed telnet option";
|
|
|
|
|
2007-10-03 04:07:50 -04:00
|
|
|
case CURLE_PEER_FAILED_VERIFICATION:
|
2009-07-22 18:49:01 -04:00
|
|
|
return "SSL peer certificate or SSH remote key was not OK";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_GOT_NOTHING:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Server returned nothing (no headers, no data)";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_SSL_ENGINE_NOTFOUND:
|
|
|
|
return "SSL crypto engine not found";
|
|
|
|
|
|
|
|
case CURLE_SSL_ENGINE_SETFAILED:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Can not set SSL crypto engine as default";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2004-12-13 11:43:00 -05:00
|
|
|
case CURLE_SSL_ENGINE_INITFAILED:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Failed to initialise SSL crypto engine";
|
2004-12-13 11:43:00 -05:00
|
|
|
|
2004-03-15 06:51:32 -05:00
|
|
|
case CURLE_SEND_ERROR:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Failed sending data to the peer";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_RECV_ERROR:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Failure when receiving data from the peer";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_SSL_CERTPROBLEM:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Problem with the local SSL certificate";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_SSL_CIPHER:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Couldn't use specified SSL cipher";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_SSL_CACERT:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Peer certificate cannot be authenticated with known CA certificates";
|
2006-10-21 07:32:05 -04:00
|
|
|
|
|
|
|
case CURLE_SSL_CACERT_BADFILE:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Problem with the SSL CA cert (path? access rights?)";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_BAD_CONTENT_ENCODING:
|
2004-04-26 03:12:29 -04:00
|
|
|
return "Unrecognized HTTP Content-Encoding";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLE_LDAP_INVALID_URL:
|
|
|
|
return "Invalid LDAP URL";
|
|
|
|
|
|
|
|
case CURLE_FILESIZE_EXCEEDED:
|
|
|
|
return "Maximum file size exceeded";
|
|
|
|
|
2007-08-31 15:36:32 -04:00
|
|
|
case CURLE_USE_SSL_FAILED:
|
|
|
|
return "Requested SSL level failed";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2007-01-08 06:24:11 -05:00
|
|
|
case CURLE_SSL_SHUTDOWN_FAILED:
|
|
|
|
return "Failed to shut down the SSL connection";
|
2007-01-05 18:11:14 -05:00
|
|
|
|
2008-06-06 14:40:21 -04:00
|
|
|
case CURLE_SSL_CRL_BADFILE:
|
|
|
|
return "Failed to load CRL file (path? access rights?, format?)";
|
|
|
|
|
2008-06-06 16:52:32 -04:00
|
|
|
case CURLE_SSL_ISSUER_ERROR:
|
|
|
|
return "Issuer check against peer certificate failed";
|
|
|
|
|
2004-11-24 13:25:33 -05:00
|
|
|
case CURLE_SEND_FAIL_REWIND:
|
|
|
|
return "Send failed since rewinding of the data stream failed";
|
|
|
|
|
2005-02-09 08:59:40 -05:00
|
|
|
case CURLE_LOGIN_DENIED:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Login denied";
|
2005-02-09 08:59:40 -05:00
|
|
|
|
2005-09-02 11:11:08 -04:00
|
|
|
case CURLE_TFTP_NOTFOUND:
|
2006-10-15 16:28:03 -04:00
|
|
|
return "TFTP: File Not Found";
|
2005-09-02 11:11:08 -04:00
|
|
|
|
|
|
|
case CURLE_TFTP_PERM:
|
2006-10-15 16:28:03 -04:00
|
|
|
return "TFTP: Access Violation";
|
2005-09-02 11:11:08 -04:00
|
|
|
|
2007-08-30 16:34:57 -04:00
|
|
|
case CURLE_REMOTE_DISK_FULL:
|
|
|
|
return "Disk full or allocation exceeded";
|
2005-09-02 11:11:08 -04:00
|
|
|
|
|
|
|
case CURLE_TFTP_ILLEGAL:
|
2006-10-15 16:28:03 -04:00
|
|
|
return "TFTP: Illegal operation";
|
2005-09-02 11:11:08 -04:00
|
|
|
|
|
|
|
case CURLE_TFTP_UNKNOWNID:
|
2006-10-15 16:28:03 -04:00
|
|
|
return "TFTP: Unknown transfer ID";
|
2005-09-02 11:11:08 -04:00
|
|
|
|
2007-08-30 16:34:57 -04:00
|
|
|
case CURLE_REMOTE_FILE_EXISTS:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Remote file already exists";
|
2005-09-02 11:11:08 -04:00
|
|
|
|
|
|
|
case CURLE_TFTP_NOSUCHUSER:
|
2006-10-15 16:28:03 -04:00
|
|
|
return "TFTP: No such user";
|
2005-09-02 11:11:08 -04:00
|
|
|
|
2006-04-07 17:50:47 -04:00
|
|
|
case CURLE_CONV_FAILED:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Conversion failed";
|
2006-04-07 17:50:47 -04:00
|
|
|
|
|
|
|
case CURLE_CONV_REQD:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Caller must register CURLOPT_CONV_ callback options";
|
2006-04-07 17:50:47 -04:00
|
|
|
|
2006-11-02 16:56:40 -05:00
|
|
|
case CURLE_REMOTE_FILE_NOT_FOUND:
|
|
|
|
return "Remote file not found";
|
|
|
|
|
|
|
|
case CURLE_SSH:
|
|
|
|
return "Error in the SSH layer";
|
|
|
|
|
2008-05-12 17:43:24 -04:00
|
|
|
case CURLE_AGAIN:
|
|
|
|
return "Socket not ready for send/recv";
|
|
|
|
|
2010-01-21 08:58:30 -05:00
|
|
|
case CURLE_RTSP_CSEQ_ERROR:
|
|
|
|
return "RTSP CSeq mismatch or invalid CSeq";
|
|
|
|
|
|
|
|
case CURLE_RTSP_SESSION_ERROR:
|
|
|
|
return "RTSP session error";
|
|
|
|
|
2010-05-12 09:33:22 -04:00
|
|
|
case CURLE_FTP_BAD_FILE_LIST:
|
|
|
|
return "Unable to parse FTP file list";
|
|
|
|
|
|
|
|
case CURLE_CHUNK_FAILED:
|
2010-05-16 16:01:17 -04:00
|
|
|
return "Chunk callback failed";
|
2010-05-12 09:33:22 -04:00
|
|
|
|
2011-01-19 14:35:02 -05:00
|
|
|
case CURLE_TLSAUTH_FAILED:
|
|
|
|
return "TLS Authentication failed";
|
|
|
|
|
2006-04-09 18:41:22 -04:00
|
|
|
/* error codes not used by current libcurl */
|
2007-08-30 16:34:57 -04:00
|
|
|
case CURLE_OBSOLETE4:
|
|
|
|
case CURLE_OBSOLETE10:
|
|
|
|
case CURLE_OBSOLETE12:
|
|
|
|
case CURLE_OBSOLETE16:
|
|
|
|
case CURLE_OBSOLETE20:
|
|
|
|
case CURLE_OBSOLETE24:
|
|
|
|
case CURLE_OBSOLETE29:
|
|
|
|
case CURLE_OBSOLETE32:
|
|
|
|
case CURLE_OBSOLETE40:
|
|
|
|
case CURLE_OBSOLETE44:
|
|
|
|
case CURLE_OBSOLETE46:
|
|
|
|
case CURLE_OBSOLETE50:
|
|
|
|
case CURLE_OBSOLETE57:
|
2004-03-15 06:51:32 -05:00
|
|
|
case CURL_LAST:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* By using a switch, gcc -Wall will complain about enum values
|
|
|
|
* which do not appear, helping keep this function up-to-date.
|
|
|
|
* By using gcc -Wall -Werror, you can't forget.
|
|
|
|
*
|
|
|
|
* A table would not have the same benefit. Most compilers will
|
|
|
|
* generate code very similar to a table in any case, so there
|
|
|
|
* is little performance gain from a table. And something is broken
|
|
|
|
* for the user's application, anyways, so does it matter how fast
|
|
|
|
* it _doesn't_ work?
|
|
|
|
*
|
|
|
|
* The line number for the error will be near this comment, which
|
|
|
|
* is why it is here, and not at the start of the switch.
|
|
|
|
*/
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Unknown error";
|
2004-11-11 11:34:24 -05:00
|
|
|
#else
|
2007-11-07 04:21:35 -05:00
|
|
|
if(error == CURLE_OK)
|
2007-08-31 13:56:06 -04:00
|
|
|
return "No error";
|
2004-11-11 11:34:24 -05:00
|
|
|
else
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Error";
|
2004-11-11 11:34:24 -05:00
|
|
|
#endif
|
2004-03-15 06:51:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
curl_multi_strerror(CURLMcode error)
|
|
|
|
{
|
2004-11-11 11:34:24 -05:00
|
|
|
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
2004-03-29 02:25:59 -05:00
|
|
|
switch (error) {
|
2004-03-15 06:51:32 -05:00
|
|
|
case CURLM_CALL_MULTI_PERFORM:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Please call curl_multi_perform() soon";
|
2004-09-19 10:28:16 -04:00
|
|
|
|
2004-03-15 06:51:32 -05:00
|
|
|
case CURLM_OK:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "No error";
|
2004-09-19 10:28:16 -04:00
|
|
|
|
2004-03-15 06:51:32 -05:00
|
|
|
case CURLM_BAD_HANDLE:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Invalid multi handle";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLM_BAD_EASY_HANDLE:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Invalid easy handle";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLM_OUT_OF_MEMORY:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Out of memory";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLM_INTERNAL_ERROR:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Internal error";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2006-04-10 11:00:53 -04:00
|
|
|
case CURLM_BAD_SOCKET:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Invalid socket argument";
|
2006-04-10 11:00:53 -04:00
|
|
|
|
|
|
|
case CURLM_UNKNOWN_OPTION:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Unknown option";
|
2006-04-10 11:00:53 -04:00
|
|
|
|
2004-03-15 06:51:32 -05:00
|
|
|
case CURLM_LAST:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Unknown error";
|
2004-11-11 11:34:24 -05:00
|
|
|
#else
|
2007-11-07 04:21:35 -05:00
|
|
|
if(error == CURLM_OK)
|
2007-08-31 13:56:06 -04:00
|
|
|
return "No error";
|
2004-11-11 11:34:24 -05:00
|
|
|
else
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Error";
|
2004-11-11 11:34:24 -05:00
|
|
|
#endif
|
2004-03-15 06:51:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
curl_share_strerror(CURLSHcode error)
|
|
|
|
{
|
2004-11-11 11:34:24 -05:00
|
|
|
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
2004-03-29 02:25:59 -05:00
|
|
|
switch (error) {
|
2004-03-15 06:51:32 -05:00
|
|
|
case CURLSHE_OK:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "No error";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLSHE_BAD_OPTION:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Unknown share option";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLSHE_IN_USE:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Share currently in use";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
|
|
|
case CURLSHE_INVALID:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Invalid share handle";
|
2004-03-15 06:51:32 -05:00
|
|
|
|
2004-05-14 07:46:35 -04:00
|
|
|
case CURLSHE_NOMEM:
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Out of memory";
|
2004-05-14 07:46:35 -04:00
|
|
|
|
2004-03-15 06:51:32 -05:00
|
|
|
case CURLSHE_LAST:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-08-31 13:56:06 -04:00
|
|
|
return "CURLSHcode unknown";
|
2004-11-11 11:34:24 -05:00
|
|
|
#else
|
2007-11-07 04:21:35 -05:00
|
|
|
if(error == CURLSHE_OK)
|
2007-08-31 13:56:06 -04:00
|
|
|
return "No error";
|
2004-11-11 11:34:24 -05:00
|
|
|
else
|
2007-08-31 13:56:06 -04:00
|
|
|
return "Error";
|
2004-11-11 11:34:24 -05:00
|
|
|
#endif
|
2004-03-15 06:51:32 -05:00
|
|
|
}
|
2004-03-24 17:45:37 -05:00
|
|
|
|
2006-10-18 17:05:40 -04:00
|
|
|
#ifdef USE_WINSOCK
|
2004-03-24 17:45:37 -05:00
|
|
|
|
|
|
|
/* This function handles most / all (?) Winsock errors cURL is able to produce.
|
|
|
|
*/
|
|
|
|
static const char *
|
|
|
|
get_winsock_error (int err, char *buf, size_t len)
|
|
|
|
{
|
2005-03-14 10:43:23 -05:00
|
|
|
const char *p;
|
2004-03-24 17:45:37 -05:00
|
|
|
|
2004-11-11 11:34:24 -05:00
|
|
|
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
2004-03-29 02:25:59 -05:00
|
|
|
switch (err) {
|
|
|
|
case WSAEINTR:
|
2007-08-31 13:56:06 -04:00
|
|
|
p = "Call interrupted";
|
2004-03-29 02:25:59 -05:00
|
|
|
break;
|
|
|
|
case WSAEBADF:
|
|
|
|
p = "Bad file";
|
|
|
|
break;
|
|
|
|
case WSAEACCES:
|
|
|
|
p = "Bad access";
|
|
|
|
break;
|
|
|
|
case WSAEFAULT:
|
|
|
|
p = "Bad argument";
|
|
|
|
break;
|
|
|
|
case WSAEINVAL:
|
|
|
|
p = "Invalid arguments";
|
|
|
|
break;
|
|
|
|
case WSAEMFILE:
|
|
|
|
p = "Out of file descriptors";
|
|
|
|
break;
|
|
|
|
case WSAEWOULDBLOCK:
|
|
|
|
p = "Call would block";
|
|
|
|
break;
|
|
|
|
case WSAEINPROGRESS:
|
|
|
|
case WSAEALREADY:
|
|
|
|
p = "Blocking call in progress";
|
|
|
|
break;
|
|
|
|
case WSAENOTSOCK:
|
2007-08-31 13:56:06 -04:00
|
|
|
p = "Descriptor is not a socket";
|
2004-03-29 02:25:59 -05:00
|
|
|
break;
|
|
|
|
case WSAEDESTADDRREQ:
|
|
|
|
p = "Need destination address";
|
|
|
|
break;
|
|
|
|
case WSAEMSGSIZE:
|
|
|
|
p = "Bad message size";
|
|
|
|
break;
|
|
|
|
case WSAEPROTOTYPE:
|
|
|
|
p = "Bad protocol";
|
|
|
|
break;
|
|
|
|
case WSAENOPROTOOPT:
|
|
|
|
p = "Protocol option is unsupported";
|
|
|
|
break;
|
|
|
|
case WSAEPROTONOSUPPORT:
|
|
|
|
p = "Protocol is unsupported";
|
|
|
|
break;
|
|
|
|
case WSAESOCKTNOSUPPORT:
|
|
|
|
p = "Socket is unsupported";
|
|
|
|
break;
|
|
|
|
case WSAEOPNOTSUPP:
|
|
|
|
p = "Operation not supported";
|
|
|
|
break;
|
|
|
|
case WSAEAFNOSUPPORT:
|
|
|
|
p = "Address family not supported";
|
|
|
|
break;
|
|
|
|
case WSAEPFNOSUPPORT:
|
|
|
|
p = "Protocol family not supported";
|
|
|
|
break;
|
|
|
|
case WSAEADDRINUSE:
|
|
|
|
p = "Address already in use";
|
|
|
|
break;
|
|
|
|
case WSAEADDRNOTAVAIL:
|
|
|
|
p = "Address not available";
|
|
|
|
break;
|
|
|
|
case WSAENETDOWN:
|
|
|
|
p = "Network down";
|
|
|
|
break;
|
|
|
|
case WSAENETUNREACH:
|
|
|
|
p = "Network unreachable";
|
|
|
|
break;
|
|
|
|
case WSAENETRESET:
|
|
|
|
p = "Network has been reset";
|
|
|
|
break;
|
|
|
|
case WSAECONNABORTED:
|
|
|
|
p = "Connection was aborted";
|
|
|
|
break;
|
|
|
|
case WSAECONNRESET:
|
|
|
|
p = "Connection was reset";
|
|
|
|
break;
|
|
|
|
case WSAENOBUFS:
|
|
|
|
p = "No buffer space";
|
|
|
|
break;
|
|
|
|
case WSAEISCONN:
|
|
|
|
p = "Socket is already connected";
|
|
|
|
break;
|
|
|
|
case WSAENOTCONN:
|
|
|
|
p = "Socket is not connected";
|
|
|
|
break;
|
|
|
|
case WSAESHUTDOWN:
|
|
|
|
p = "Socket has been shut down";
|
|
|
|
break;
|
|
|
|
case WSAETOOMANYREFS:
|
|
|
|
p = "Too many references";
|
|
|
|
break;
|
|
|
|
case WSAETIMEDOUT:
|
|
|
|
p = "Timed out";
|
|
|
|
break;
|
|
|
|
case WSAECONNREFUSED:
|
|
|
|
p = "Connection refused";
|
|
|
|
break;
|
|
|
|
case WSAELOOP:
|
|
|
|
p = "Loop??";
|
|
|
|
break;
|
|
|
|
case WSAENAMETOOLONG:
|
|
|
|
p = "Name too long";
|
|
|
|
break;
|
|
|
|
case WSAEHOSTDOWN:
|
|
|
|
p = "Host down";
|
|
|
|
break;
|
|
|
|
case WSAEHOSTUNREACH:
|
|
|
|
p = "Host unreachable";
|
|
|
|
break;
|
|
|
|
case WSAENOTEMPTY:
|
|
|
|
p = "Not empty";
|
|
|
|
break;
|
|
|
|
case WSAEPROCLIM:
|
|
|
|
p = "Process limit reached";
|
|
|
|
break;
|
|
|
|
case WSAEUSERS:
|
|
|
|
p = "Too many users";
|
|
|
|
break;
|
|
|
|
case WSAEDQUOT:
|
|
|
|
p = "Bad quota";
|
|
|
|
break;
|
|
|
|
case WSAESTALE:
|
|
|
|
p = "Something is stale";
|
|
|
|
break;
|
|
|
|
case WSAEREMOTE:
|
|
|
|
p = "Remote error";
|
|
|
|
break;
|
2006-04-26 13:26:22 -04:00
|
|
|
#ifdef WSAEDISCON /* missing in SalfordC! */
|
2004-03-29 02:25:59 -05:00
|
|
|
case WSAEDISCON:
|
|
|
|
p = "Disconnected";
|
|
|
|
break;
|
2006-04-26 13:26:22 -04:00
|
|
|
#endif
|
2004-03-24 17:45:37 -05:00
|
|
|
/* Extended Winsock errors */
|
2004-03-29 02:25:59 -05:00
|
|
|
case WSASYSNOTREADY:
|
|
|
|
p = "Winsock library is not ready";
|
|
|
|
break;
|
|
|
|
case WSANOTINITIALISED:
|
2005-07-21 18:18:35 -04:00
|
|
|
p = "Winsock library not initialised";
|
2004-03-29 02:25:59 -05:00
|
|
|
break;
|
|
|
|
case WSAVERNOTSUPPORTED:
|
2007-08-31 13:56:06 -04:00
|
|
|
p = "Winsock version not supported";
|
2004-03-29 02:25:59 -05:00
|
|
|
break;
|
2004-03-24 17:45:37 -05:00
|
|
|
|
|
|
|
/* getXbyY() errors (already handled in herrmsg):
|
|
|
|
* Authoritative Answer: Host not found */
|
2004-03-29 02:25:59 -05:00
|
|
|
case WSAHOST_NOT_FOUND:
|
|
|
|
p = "Host not found";
|
|
|
|
break;
|
2004-03-24 17:45:37 -05:00
|
|
|
|
|
|
|
/* Non-Authoritative: Host not found, or SERVERFAIL */
|
2004-03-29 02:25:59 -05:00
|
|
|
case WSATRY_AGAIN:
|
|
|
|
p = "Host not found, try again";
|
|
|
|
break;
|
2004-03-24 17:45:37 -05:00
|
|
|
|
|
|
|
/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
|
2004-03-29 02:25:59 -05:00
|
|
|
case WSANO_RECOVERY:
|
|
|
|
p = "Unrecoverable error in call to nameserver";
|
|
|
|
break;
|
2004-03-24 17:45:37 -05:00
|
|
|
|
|
|
|
/* Valid name, no data record of requested type */
|
2004-03-29 02:25:59 -05:00
|
|
|
case WSANO_DATA:
|
|
|
|
p = "No data record of requested type";
|
|
|
|
break;
|
2004-03-24 17:45:37 -05:00
|
|
|
|
2004-03-29 02:25:59 -05:00
|
|
|
default:
|
|
|
|
return NULL;
|
2004-03-24 17:45:37 -05:00
|
|
|
}
|
2004-11-11 11:34:24 -05:00
|
|
|
#else
|
2007-11-07 04:21:35 -05:00
|
|
|
if(err == CURLE_OK)
|
2004-11-11 11:34:24 -05:00
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
p = "error";
|
|
|
|
#endif
|
2004-03-24 17:45:37 -05:00
|
|
|
strncpy (buf, p, len);
|
|
|
|
buf [len-1] = '\0';
|
|
|
|
return buf;
|
|
|
|
}
|
2006-10-18 17:05:40 -04:00
|
|
|
#endif /* USE_WINSOCK */
|
2004-03-24 17:45:37 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Our thread-safe and smart strerror() replacement.
|
2004-04-06 02:06:10 -04:00
|
|
|
*
|
|
|
|
* The 'err' argument passed in to this function MUST be a true errno number
|
|
|
|
* as reported on this system. We do no range checking on the number before
|
2007-08-31 13:56:06 -04:00
|
|
|
* we pass it to the "number-to-message" conversion function and there might
|
2004-04-06 02:06:10 -04:00
|
|
|
* be systems that don't do proper range checking in there themselves.
|
|
|
|
*
|
|
|
|
* We don't do range checking (on systems other than Windows) since there is
|
|
|
|
* no good reliable and portable way to do it.
|
2004-03-24 17:45:37 -05:00
|
|
|
*/
|
|
|
|
const char *Curl_strerror(struct connectdata *conn, int err)
|
|
|
|
{
|
|
|
|
char *buf, *p;
|
|
|
|
size_t max;
|
2008-09-12 06:51:57 -04:00
|
|
|
int old_errno = ERRNO;
|
2004-03-24 17:45:37 -05:00
|
|
|
|
2007-02-21 14:03:20 -05:00
|
|
|
DEBUGASSERT(conn);
|
|
|
|
DEBUGASSERT(err >= 0);
|
2004-03-24 17:45:37 -05:00
|
|
|
|
|
|
|
buf = conn->syserr_buf;
|
|
|
|
max = sizeof(conn->syserr_buf)-1;
|
|
|
|
*buf = '\0';
|
2004-04-06 02:06:10 -04:00
|
|
|
|
2006-10-18 17:05:40 -04:00
|
|
|
#ifdef USE_WINSOCK
|
2004-11-02 05:12:22 -05:00
|
|
|
|
2005-03-15 02:47:59 -05:00
|
|
|
#ifdef _WIN32_WCE
|
2004-11-02 05:12:22 -05:00
|
|
|
{
|
|
|
|
wchar_t wbuf[256];
|
2008-09-12 06:51:57 -04:00
|
|
|
wbuf[0] = L'\0';
|
2004-11-02 05:12:22 -05:00
|
|
|
|
|
|
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
|
|
|
|
LANG_NEUTRAL, wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL);
|
|
|
|
wcstombs(buf,wbuf,max);
|
|
|
|
}
|
|
|
|
#else
|
2004-04-06 02:06:10 -04:00
|
|
|
/* 'sys_nerr' is the maximum errno number, it is not widely portable */
|
2007-11-07 04:21:35 -05:00
|
|
|
if(err >= 0 && err < sys_nerr)
|
2004-04-06 08:02:36 -04:00
|
|
|
strncpy(buf, strerror(err), max);
|
|
|
|
else {
|
2007-11-07 04:21:35 -05:00
|
|
|
if(!get_winsock_error(err, buf, max) &&
|
2004-11-02 05:12:22 -05:00
|
|
|
!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
|
2005-04-26 09:08:49 -04:00
|
|
|
LANG_NEUTRAL, buf, (DWORD)max, NULL))
|
2004-04-06 02:06:10 -04:00
|
|
|
snprintf(buf, max, "Unknown error %d (%#x)", err, err);
|
|
|
|
}
|
2004-11-02 05:12:22 -05:00
|
|
|
#endif
|
2008-09-12 06:51:57 -04:00
|
|
|
|
2006-10-18 17:05:40 -04:00
|
|
|
#else /* not USE_WINSOCK coming up */
|
2004-09-19 10:28:16 -04:00
|
|
|
|
2008-09-12 06:51:57 -04:00
|
|
|
#if defined(HAVE_STRERROR_R) && defined(HAVE_POSIX_STRERROR_R)
|
|
|
|
/*
|
|
|
|
* The POSIX-style strerror_r() may set errno to ERANGE if insufficient
|
|
|
|
* storage is supplied via 'strerrbuf' and 'buflen' to hold the generated
|
|
|
|
* message string, or EINVAL if 'errnum' is not a valid error number.
|
|
|
|
*/
|
|
|
|
if(0 != strerror_r(err, buf, max)) {
|
|
|
|
if('\0' == buf[0])
|
|
|
|
snprintf(buf, max, "Unknown error %d", err);
|
|
|
|
}
|
|
|
|
#elif defined(HAVE_STRERROR_R) && defined(HAVE_GLIBC_STRERROR_R)
|
|
|
|
/*
|
|
|
|
* The glibc-style strerror_r() only *might* use the buffer we pass to
|
|
|
|
* the function, but it always returns the error message as a pointer,
|
|
|
|
* so we must copy that string unconditionally (if non-NULL).
|
|
|
|
*/
|
2004-04-06 02:06:10 -04:00
|
|
|
{
|
2004-03-25 07:45:01 -05:00
|
|
|
char buffer[256];
|
|
|
|
char *msg = strerror_r(err, buffer, sizeof(buffer));
|
2006-08-01 05:39:01 -04:00
|
|
|
if(msg)
|
|
|
|
strncpy(buf, msg, max);
|
|
|
|
else
|
|
|
|
snprintf(buf, max, "Unknown error %d", err);
|
2004-03-29 02:25:59 -05:00
|
|
|
}
|
2009-06-04 15:11:11 -04:00
|
|
|
#elif defined(HAVE_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)
|
|
|
|
/*
|
|
|
|
* The vxworks-style strerror_r() does use the buffer we pass to the function.
|
|
|
|
* The buffer size should be at least MAXERRSTR_SIZE (150) defined in rtsold.h
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
char buffer[256];
|
|
|
|
if(OK == strerror_r(err, buffer))
|
|
|
|
strncpy(buf, buffer, max);
|
|
|
|
else
|
|
|
|
snprintf(buf, max, "Unknown error %d", err);
|
|
|
|
}
|
2008-09-12 06:51:57 -04:00
|
|
|
#else
|
|
|
|
{
|
|
|
|
char *msg = strerror(err);
|
|
|
|
if(msg)
|
|
|
|
strncpy(buf, msg, max);
|
|
|
|
else
|
|
|
|
snprintf(buf, max, "Unknown error %d", err);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-10-18 17:05:40 -04:00
|
|
|
#endif /* end of ! USE_WINSOCK */
|
2004-04-06 02:06:10 -04:00
|
|
|
|
|
|
|
buf[max] = '\0'; /* make sure the string is zero terminated */
|
2004-03-24 17:45:37 -05:00
|
|
|
|
|
|
|
/* strip trailing '\r\n' or '\n'. */
|
2007-11-07 04:21:35 -05:00
|
|
|
if((p = strrchr(buf,'\n')) != NULL && (p - buf) >= 2)
|
2004-03-24 17:45:37 -05:00
|
|
|
*p = '\0';
|
2007-11-07 04:21:35 -05:00
|
|
|
if((p = strrchr(buf,'\r')) != NULL && (p - buf) >= 1)
|
2004-03-24 17:45:37 -05:00
|
|
|
*p = '\0';
|
2008-09-12 06:51:57 -04:00
|
|
|
|
|
|
|
if(old_errno != ERRNO)
|
|
|
|
SET_ERRNO(old_errno);
|
|
|
|
|
2004-03-24 17:45:37 -05:00
|
|
|
return buf;
|
|
|
|
}
|
2004-10-02 09:01:44 -04:00
|
|
|
|
|
|
|
#ifdef USE_LIBIDN
|
|
|
|
/*
|
2004-10-05 04:40:26 -04:00
|
|
|
* Return error-string for libidn status as returned from idna_to_ascii_lz().
|
2004-10-02 09:01:44 -04:00
|
|
|
*/
|
|
|
|
const char *Curl_idn_strerror (struct connectdata *conn, int err)
|
|
|
|
{
|
2004-10-05 04:40:26 -04:00
|
|
|
#ifdef HAVE_IDNA_STRERROR
|
2004-10-05 04:42:56 -04:00
|
|
|
(void)conn;
|
2004-10-05 04:40:26 -04:00
|
|
|
return idna_strerror((Idna_rc) err);
|
|
|
|
#else
|
2004-10-02 09:01:44 -04:00
|
|
|
const char *str;
|
|
|
|
char *buf;
|
|
|
|
size_t max;
|
|
|
|
|
2007-02-21 14:03:20 -05:00
|
|
|
DEBUGASSERT(conn);
|
2004-10-02 09:01:44 -04:00
|
|
|
|
|
|
|
buf = conn->syserr_buf;
|
|
|
|
max = sizeof(conn->syserr_buf)-1;
|
2008-09-12 06:51:57 -04:00
|
|
|
*buf = '\0';
|
2004-10-02 09:01:44 -04:00
|
|
|
|
2004-11-11 11:34:24 -05:00
|
|
|
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
2004-10-02 09:01:44 -04:00
|
|
|
switch ((Idna_rc)err) {
|
|
|
|
case IDNA_SUCCESS:
|
|
|
|
str = "No error";
|
|
|
|
break;
|
|
|
|
case IDNA_STRINGPREP_ERROR:
|
|
|
|
str = "Error in string preparation";
|
|
|
|
break;
|
|
|
|
case IDNA_PUNYCODE_ERROR:
|
|
|
|
str = "Error in Punycode operation";
|
|
|
|
break;
|
|
|
|
case IDNA_CONTAINS_NON_LDH:
|
|
|
|
str = "Illegal ASCII characters";
|
|
|
|
break;
|
|
|
|
case IDNA_CONTAINS_MINUS:
|
|
|
|
str = "Contains minus";
|
|
|
|
break;
|
|
|
|
case IDNA_INVALID_LENGTH:
|
|
|
|
str = "Invalid output length";
|
|
|
|
break;
|
|
|
|
case IDNA_NO_ACE_PREFIX:
|
|
|
|
str = "No ACE prefix (\"xn--\")";
|
|
|
|
break;
|
|
|
|
case IDNA_ROUNDTRIP_VERIFY_ERROR:
|
2007-08-31 13:56:06 -04:00
|
|
|
str = "Round trip verify error";
|
2004-10-02 09:01:44 -04:00
|
|
|
break;
|
|
|
|
case IDNA_CONTAINS_ACE_PREFIX:
|
|
|
|
str = "Already have ACE prefix (\"xn--\")";
|
|
|
|
break;
|
|
|
|
case IDNA_ICONV_ERROR:
|
|
|
|
str = "Locale conversion failed";
|
|
|
|
break;
|
|
|
|
case IDNA_MALLOC_ERROR:
|
|
|
|
str = "Allocation failed";
|
|
|
|
break;
|
|
|
|
case IDNA_DLOPEN_ERROR:
|
|
|
|
str = "dlopen() error";
|
|
|
|
break;
|
|
|
|
default:
|
2008-09-04 14:59:05 -04:00
|
|
|
snprintf(buf, max, "error %d", err);
|
2004-10-02 09:01:44 -04:00
|
|
|
str = NULL;
|
|
|
|
break;
|
|
|
|
}
|
2004-11-11 11:34:24 -05:00
|
|
|
#else
|
2007-11-07 04:21:35 -05:00
|
|
|
if((Idna_rc)err == IDNA_SUCCESS)
|
2004-11-11 11:34:24 -05:00
|
|
|
str = "No error";
|
|
|
|
else
|
2007-08-31 13:56:06 -04:00
|
|
|
str = "Error";
|
2004-11-11 11:34:24 -05:00
|
|
|
#endif
|
2007-11-07 04:21:35 -05:00
|
|
|
if(str)
|
2004-10-02 09:01:44 -04:00
|
|
|
strncpy(buf, str, max);
|
|
|
|
buf[max] = '\0';
|
|
|
|
return (buf);
|
2004-10-05 04:40:26 -04:00
|
|
|
#endif
|
2004-10-02 09:01:44 -04:00
|
|
|
}
|
|
|
|
#endif /* USE_LIBIDN */
|