aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-11-17 14:29:54 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-11-17 14:29:54 +0000
commit4022a60ea7f88650f1b4abfe1e41c973cca7861d (patch)
tree1864df6f2a37c0f938f8a5cc5838463f6b4c1314
parent39e366fc11f848c0424d75a914ce98a0e39995f0 (diff)
I extended a patch from David Shaw to make libcurl _always_ provide an error
string in the given error buffer to address the flaw mention on 21 sep 2005.
-rw-r--r--CHANGES4
-rw-r--r--RELEASE-NOTES3
-rw-r--r--docs/libcurl/curl_easy_setopt.36
-rw-r--r--lib/transfer.c13
4 files changed, 19 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index fd1eb7589..60c71921e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,10 @@
+Daniel (17 November 2005)
+- I extended a patch from David Shaw to make libcurl _always_ provide an error
+ string in the given error buffer to address the flaw mention on 21 sep 2005.
+
Daniel (16 November 2005)
- Applied Albert Chin's patch that makes the libcurl.pc pkgconfig file get
installed on 'make install' time.
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index d05adf359..eecf78aaf 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -19,6 +19,7 @@ This release includes the following changes:
This release includes the following bugfixes:
+ o CURLOPT_ERRORBUFFER is now always filled in on errors
o curl outputs error on bad --limit-rate units
o fixed libcurl's use of poll() on cygwin
o the GnuTLS code didn't support client certificates
@@ -51,6 +52,6 @@ advice from friends like these:
Dave Dribin, Bradford Bruce, Temprimus, Ofer, Dima Barsky, Amol Pattekar, Jaz
Fresh, tommink[at]post.pl, Gisle Vanem, Nis Jorgensen, Vilmos Nebehaj,
Dmitry Bartsevich, David Lang, Eugene Kotlyarov, Jan Kunder, Yang Tse,
- Quagmire, Albert Chin
+ Quagmire, Albert Chin, David Shaw
Thanks! (and sorry if I forgot to mention someone)
diff --git a/docs/libcurl/curl_easy_setopt.3 b/docs/libcurl/curl_easy_setopt.3
index 8509aeb68..0cabd0047 100644
--- a/docs/libcurl/curl_easy_setopt.3
+++ b/docs/libcurl/curl_easy_setopt.3
@@ -270,12 +270,6 @@ debug/trace why errors happen.
If the library does not return an error, the buffer may not have been
touched. Do not rely on the contents in those cases.
-In a few rare cases, there is no text string associated with the error in
-libcurl and then you may not get a string in the buffer even though it returns
-an error. This is considered a bug and we appreciate your reports about these
-cases. Anyway, you can avoid problems with these cases in your program by
-making sure to clear the first byte of the error buffer before you call
-curl_easy_perform().
.IP CURLOPT_STDERR
Pass a FILE * as parameter. Tell libcurl to use this stream instead of stderr
when showing the progress meter and displaying \fICURLOPT_VERBOSE\fP data.
diff --git a/lib/transfer.c b/lib/transfer.c
index 1706ccb6f..664a412bd 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -2217,6 +2217,19 @@ CURLcode Curl_perform(struct SessionHandle *data)
if(newurl)
free(newurl);
+ if(res && !data->state.errorbuf) {
+ /*
+ * As an extra precaution: if no error string has been set and there was
+ * an error, use the strerror() string or if things are so bad that not
+ * even that is good, set a bad string that mentions the error code.
+ */
+ char *str = curl_easy_strerror(res);
+ if(!str)
+ failf(data, "unspecified error %d", (int)res);
+ else
+ failf(data, "%s", str);
+ }
+
/* run post-transfer uncondionally, but don't clobber the return code if
we already have an error code recorder */
res2 = Curl_posttransfer(data);