summaryrefslogtreecommitdiff
path: root/lib/strerror.c
Commit message (Collapse)AuthorAgeFilesLines
* checksrc: check for spaces before the colon of switch labelsEmanuele Torre2023-04-271-2/+2
| | | | Closes #11047
* copyright: update all copyright lines and remove year rangesDaniel Stenberg2023-01-031-1/+1
| | | | | | | | | | | | - they are mostly pointless in all major jurisdictions - many big corporations and projects already don't use them - saves us from pointless churn - git keeps history for us - the year range is kept in COPYING checksrc is updated to allow non-year using copyright statements Closes #10205
* urlapi: add CURLU_PUNYCODEDaniel Stenberg2022-12-261-0/+3
| | | | | | | | | Allows curl_url_get() get the punycode version of host names for the host name and URL parts. Extend test 1560 to verify. Closes #10109
* strerror: improve two URL API error messagesDaniel Stenberg2022-09-151-2/+2
|
* curl.h: CURLE_CONV_FAILED is obsoletedDaniel Stenberg2022-06-291-3/+1
| | | | | | | The last use was removed in 7.82.0. Updated some docs too to reflect the current error code situation. Closes #9067
* copyright: make repository REUSE compliantmax.mehl2022-06-131-0/+2
| | | | | | | | | | | Add licensing and copyright information for all files in this repository. This either happens in the file itself as a comment header or in the file `.reuse/dep5`. This commit also adds a Github workflow to check pull requests and adapts copyright.pl to the changes. Closes #8869
* select: return error from "lethal" poll/select errorsDaniel Stenberg2022-06-081-0/+6
| | | | | | | | | Adds two new error codes: CURLE_UNRECOVERABLE_POLL and CURLM_UNRECOVERABLE_POLL one each for the easy and the multi interfaces. Reported-by: Harry Sintonen Fixes #8921 Closes #8961
* lib: remove support for CURL_DOES_CONVERSIONSDaniel Stenberg2022-02-041-3/+1
| | | | | | TPF was the only user and support for that was dropped. Closes #8378
* vxworks: drop supportDaniel Stenberg2022-02-011-17/+2
| | | | | | | No changes or fixes in vxworks related code since 2009 leads me to believe that this doesn't work anymore. Closes #8362
* ldap: return CURLE_URL_MALFORMAT for bad URLDaniel Stenberg2022-01-101-4/+2
| | | | | | | | For consistency, use the same return code for URL malformats, independently of what scheme that is used. Previously this would return CURLE_LDAP_INVALID_URL, but starting now that error cannot be returned. Closes #8170
* multi: handle errors returned from socket/timer callbacksDaniel Stenberg2021-12-061-0/+3
| | | | | | | | | | | | The callbacks were partially documented to support this. Now the behavior is documented and returning error from either of these callbacks will effectively kill all currently ongoing transfers. Added test 530 to verify Reported-by: Marcelo Juchem Fixes #8083 Closes #8089
* urlapi: provide more detailed return codesbagder/urlapi-returncodesDaniel Stenberg2021-11-251-10/+46
| | | | | | | | | | | | | | | | | | | | Previously, the return code CURLUE_MALFORMED_INPUT was used for almost 30 different URL format violations. This made it hard for users to understand why a particular URL was not acceptable. Since the API cannot point out a specific position within the URL for the problem, this now instead introduces a number of additional and more fine-grained error codes to allow the API to return more exactly in what "part" or section of the URL a problem was detected. Also bug-fixes curl_url_get() with CURLUPART_ZONEID, which previously returned CURLUE_OK even if no zoneid existed. Test cases in 1560 have been adjusted and extended. Tests 1538 and 1559 have been updated. Updated libcurl-errors.3 and curl_url_strerror() accordingly. Closes #8049
* urlapi: add curl_url_strerror()i-ky2021-09-271-0/+72
| | | | | | | | | | Add curl_url_strerror() to convert CURLUcode into readable string and facilitate easier troubleshooting in programs using URL API. Extend CURLUcode with CURLU_LAST for iteration in unit tests. Update man pages with a mention of new function. Update example code and tests with new functionality where it fits. Closes #7605
* strerror: use sys_errlist instead of strerror on WindowsJay Satiro2021-09-171-2/+2
| | | | | | | | | | | | | | | - Change Curl_strerror to use sys_errlist[errnum] instead of strerror to retrieve the error message on Windows. Windows' strerror writes to a static buffer and is not thread-safe. Follow-up to 2f0bb86 which removed most instances of strerror in favor of calling Curl_strerror (which calls strerror_r for other platforms). Ref: https://github.com/curl/curl/pull/7685 Ref: https://github.com/curl/curl/commit/2f0bb86 Closes https://github.com/curl/curl/pull/7735
* lib: don't use strerror()Daniel Stenberg2021-09-091-0/+1
| | | | | | | | | | We have and provide Curl_strerror() internally for a reason: strerror() is not necessarily thread-safe so we should always try to avoid it. Extended checksrc to warn for this, but feature the check disabled by default and only enable it in lib/ Closes #7685
* CURLE_SETOPT_OPTION_SYNTAX: new error name for wrong setopt syntaxDaniel Stenberg2021-06-021-2/+2
| | | | | | | | | For options that pass in lists or strings that are subsequently parsed and must be correct. This broadens the scope for the option previously known as CURLE_TELNET_OPTION_SYNTAX but the old name is of course still provided as a #define for existing applications. Closes #7175
* CURLcode: add CURLE_SSL_CLIENTCERTejanchivdorj2021-05-031-1/+4
| | | | | | | | | | When a TLS server requests a client certificate during handshake and none can be provided, libcurl now returns this new error code CURLE_SSL_CLIENTCERT Only supported by Secure Transport and OpenSSL for TLS 1.3 so far. Closes #6721
* copyright: fix missing year (range) updatesDaniel Stenberg2021-01-291-1/+1
|
* strerror: skip errnum >= 0 assertion on windowsJay Satiro2021-01-221-0/+2
| | | | | | | | | On Windows an error number may be greater than INT_MAX and negative once cast to int. The assertion is checked only in debug builds. Closes https://github.com/curl/curl/pull/6504
* curl.se: new homeDaniel Stenberg2020-11-041-1/+1
| | | | Closes #6172
* strerror: use 'const' as the string should never be modifiedPhilipp Klaus Krause2020-10-151-1/+1
| | | | Closes #6068
* strerror: Revert to local codepage for Windows error stringJay Satiro2020-10-131-16/+15
| | | | | | | | | | | | | | | | | | | | - Change get_winapi_error() to return the error string in the local codepage instead of UTF-8 encoding. Two weeks ago bed5f84 fixed get_winapi_error() to work on xbox, but it also changed the error string's encoding from local codepage to UTF-8. We return the local codepage version of the error string because if it is output to the user's terminal it will likely be with functions which expect the local codepage (eg fprintf, failf, infof). This is essentially a partial revert of bed5f84. The support for xbox remains but the error string is reverted back to local codepage. Ref: https://github.com/curl/curl/pull/6005 Reviewed-by: Marcel Raad Closes #6065
* strerror: fix null deref on winapi out-of-memoryJay Satiro2020-10-011-3/+5
| | | | | | Follow-up to bed5f84 from several days ago. Ref: https://github.com/curl/curl/pull/6005
* strerror: honor Unicode API choice on WindowsJavier Blazquez2020-09-251-15/+7
| | | | Closes #6005
* CURLE_PROXY: new error codeDaniel Stenberg2020-08-241-0/+3
| | | | | | | | | | | | Failures clearly returned from a (SOCKS) proxy now causes this return code. Previously the situation was not very clear as what would be returned and when. In addition: when this error code is returned, an application can use CURLINFO_PROXY_ERROR to query libcurl for the detailed error, which then returns a value from the new 'CURLproxycode' enum. Closes #5770
* terminology: call them null-terminated stringsDaniel Stenberg2020-06-281-1/+1
| | | | | | | | | | | Updated terminology in docs, comments and phrases to refer to C strings as "null-terminated". Done to unify with how most other C oriented docs refer of them and what users in general seem to prefer (based on a single highly unscientific poll on twitter). Reported-by: coinhubs on github Fixes #5598 Closes #5608
* ngtcp2: Add an error code for QUIC connection errorsEmil Engler2020-01-111-0/+3
| | | | | | | | | | - Add new error code CURLE_QUIC_CONNECT_ERROR for QUIC connection errors. Prior to this change CURLE_FAILED_INIT was used, but that was not correct. Closes https://github.com/curl/curl/pull/4754
* multi: Change curl_multi_wait/poll to error on negative timeoutJay Satiro2020-01-111-0/+3
| | | | | | | | | | | | | | - Add new error CURLM_BAD_FUNCTION_ARGUMENT and return that error when curl_multi_wait/poll is passed timeout param < 0. Prior to this change passing a negative value to curl_multi_wait/poll such as -1 could cause the function to wait forever. Reported-by: hamstergene@users.noreply.github.com Fixes https://github.com/curl/curl/issues/4763 Closes https://github.com/curl/curl/pull/4765
* lib: fix compiler warnings with `CURL_DISABLE_VERBOSE_STRINGS`Marcel Raad2020-01-031-1/+4
| | | | Closes https://github.com/curl/curl/pull/4775
* strerror: Fix compiler warning "empty expression"Gisle Vanem2019-12-181-1/+1
| | | | | | | | | | | | | - Remove the final semi-colon in the SEC2TXT() macro definition. Before: #define SEC2TXT(sec) case sec: txt = #sec; break; After: #define SEC2TXT(sec) case sec: txt = #sec; break Prior to this change SEC2TXT(foo); would generate break;; which caused the empty expression warning. Ref: https://github.com/curl/curl/commit/5b22e1a#r36458547
* strerror: Add Curl_winapi_strerror for Win API specific errorsJay Satiro2019-12-011-341/+228
| | | | | | | | | | | | | | | - In all code call Curl_winapi_strerror instead of Curl_strerror when the error code is known to be from Windows GetLastError. Curl_strerror prefers CRT error codes (errno) over Windows API error codes (GetLastError) when the two overlap. When we know the error code is from GetLastError it is more accurate to prefer the Windows API error messages. Reported-by: Richard Alcock Fixes https://github.com/curl/curl/issues/4550 Closes https://github.com/curl/curl/pull/4581
* multi: add curl_multi_wakeup()Gergely Nagy2019-11-251-0/+3
| | | | | | | | | | | | This commit adds curl_multi_wakeup() which was previously in the TODO list under the curl_multi_unblock name. On some platforms and with some configurations this feature might not be available or can fail, in these cases a new error code (CURLM_WAKEUP_FAILURE) is returned from curl_multi_wakeup(). Fixes #4418 Closes #4608
* include: make CURLE_HTTP3 use a new error codeDaniel Stenberg2019-11-211-0/+1
| | | | | | | | | To avoid potential issues with error code reuse. Reported-by: Christoph M. Becker Assisted-by: Dan Fandrich Fixes #4601 Closes #4627
* quiche: reject headers in the wrong orderDaniel Stenberg2019-11-121-1/+3
| | | | | | | | Pseudo header MUST come before regular headers or cause an error. Reported-by: Cynthia Coan Fixes #4571 Closes #4584
* strerror: Fix an error looking up some Windows error stringsJay Satiro2019-11-091-2/+4
| | | | | | | | | | | | | | | | | | - Use FORMAT_MESSAGE_IGNORE_INSERTS to ignore format specifiers in Windows error strings. Since we are not in control of the error code we don't know what information may be needed by the error string's format specifiers. Prior to this change Windows API error strings which contain specifiers (think specifiers like similar to printf specifiers) would not be shown. The FormatMessage Windows API call which turns a Windows error code into a string could fail and set error ERROR_INVALID_PARAMETER if that error string contained a format specifier. FormatMessage expects a va_list for the specifiers, unless inserts are ignored in which case no substitution is attempted. Ref: https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353
* vauth: Use CURLE_AUTH_ERROR for auth function errorsJay Satiro2019-08-141-0/+3
| | | | | | | | | | | | | | - Add new error code CURLE_AUTH_ERROR. Prior to this change auth function errors were signaled by CURLE_OUT_OF_MEMORY and CURLE_RECV_ERROR, and neither one was technically correct. Ref: https://github.com/curl/curl/pull/3848 Co-authored-by: Dominik Hölzl Closes https://github.com/curl/curl/pull/3864
* strerror: make the strerror function use local buffersDaniel Stenberg2019-02-261-12/+8
| | | | | | | | | | | | | | | | Instead of using a fixed 256 byte buffer in the connectdata struct. In my build, this reduces the size of the connectdata struct by 11.8%, from 2160 to 1904 bytes with no functionality or performance loss. This also fixes a bug in schannel's Curl_verify_certificate where it called Curl_sspi_strerror when it should have called Curl_strerror for string from GetLastError. the only effect would have been no text or the wrong text being shown for the error. Co-authored-by: Jay Satiro Closes #3612
* snprintf: renamed and we now only use msnprintf()Daniel Stenberg2018-11-231-13/+13
| | | | | | | | | | | The function does not return the same value as snprintf() normally does, so readers may be mislead into thinking the code works differently than it actually does. A different function name makes this easier to detect. Reported-by: Tomas Hoger Assisted-by: Daniel Gustafsson Fixes #3296 Closes #3297
* ssl: deprecate CURLE_SSL_CACERT in favour of a unified error codeHan Han2018-09-061-6/+3
| | | | Long live CURLE_PEER_FAILED_VERIFICATION
* TODO fixed: Detect when called from within callbacksBjörn Stenberg2018-02-151-0/+6
| | | | Closes #2302
* strerror: Preserve Windows error code in some functionsJay Satiro2017-07-111-25/+42
| | | | | | | | | | | This is a follow-up to af02162 which removed (SET_)ERRNO macros. That commit was an earlier draft that I committed by mistake, which was then remedied by a5834e5 and e909de6, and now this commit. With this commit there is now no difference between the current code and the changes that were approved in the final draft. Thanks-to: Max Dymond, Marcel Raad, Daniel Stenberg, Gisle Vanem Ref: https://github.com/curl/curl/pull/1589
* errno: fix non-windows builds after af0216251b94e7Daniel Stenberg2017-07-101-5/+7
|
* curl_setup_once: Remove ERRNO/SET_ERRNO macrosJay Satiro2017-07-101-6/+18
| | | | | | | | | | | | Prior to this change (SET_)ERRNO mapped to GetLastError/SetLastError for Win32 and regular errno otherwise. I reviewed the code and found no justifiable reason for conflating errno on WIN32 with GetLastError/SetLastError. All Win32 CRTs support errno, and any Win32 multithreaded CRT supports thread-local errno. Fixes https://github.com/curl/curl/issues/895 Closes https://github.com/curl/curl/pull/1589
* checksrc: warn for assignments within if() expressionsDaniel Stenberg2016-12-141-8/+12
| | | | | ... they're already frowned upon in our source code style guide, this now enforces the rule harder.
* checksrc: stricter no-space-before-paren enforcementDaniel Stenberg2016-12-131-6/+6
| | | | In order to make the code style more uniform everywhere
* idn: switch to libidn2 use and IDNA2008 supportDaniel Stenberg2016-10-311-79/+2
| | | | | | | CVE-2016-8625 Bug: https://curl.haxx.se/docs/adv_20161102K.html Reported-by: Christian Heimes
* s/cURL/curlDaniel Stenberg2016-10-181-1/+1
| | | | | The tool was never called cURL, only the project. But even so, we have more and more over time switched to just use lower case.
* errors: new alias CURLE_WEIRD_SERVER_REPLY (8)Jay Satiro2016-09-071-2/+2
| | | | | | | | Since we're using CURLE_FTP_WEIRD_SERVER_REPLY in imap, pop3 and smtp as more of a generic "failed to parse" introduce an alias without FTP in the name. Closes https://github.com/curl/curl/pull/975
* lib: include curl_printf.h as one of the last headersDaniel Stenberg2016-04-291-2/+2
| | | | | | | | | | | | | | | | | | | | curl_printf.h defines printf to curl_mprintf, etc. This can cause problems with external headers which may use __attribute__((format(printf, ...))) markers etc. To avoid that they cause problems with system includes, we include curl_printf.h after any system headers. That makes the three last headers to always be, and we keep them in this order: curl_printf.h curl_memory.h memdebug.h None of them include system headers, they all do funny #defines. Reported-by: David Benjamin Fixes #743
* http2: Add handling stream level errorTatsuhiro Tsujikawa2016-04-111-0/+3
| | | | | | | | | | | | | Previously, when a stream was closed with other than NGHTTP2_NO_ERROR by RST_STREAM, underlying TCP connection was dropped. This is undesirable since there may be other streams multiplexed and they are very much fine. This change introduce new error code CURLE_HTTP2_STREAM, which indicates stream error that only affects the relevant stream, and connection should be kept open. The existing CURLE_HTTP2 means connection error in general. Ref: https://github.com/curl/curl/issues/659 Ref: https://github.com/curl/curl/pull/663