Mercurial > hg > octave-jordi
changeset 9885:dd3fc8ba4796
support libcurl < 7.19
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sun, 29 Nov 2009 07:49:40 +0100 |
parents | fed4aad2cdca |
children | cddd5c3d5f04 |
files | src/ChangeLog src/DLD-FUNCTIONS/urlwrite.cc |
diffstat | 2 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-11-29 Jaroslav Hajek <highegg@gmail.com> + + * DLD-FUNCTIONS/urlwrite.cc (curl_handle::init): Use CURLOPT_USERPWD + if libcurl ver < 7.19.0. + 2009-11-28 Shai Ayal <shaiay@users.sourceforge.net> * gl-render.cc (opengl_renderer::draw_image): Handle indexed images.
--- a/src/DLD-FUNCTIONS/urlwrite.cc +++ b/src/DLD-FUNCTIONS/urlwrite.cc @@ -51,6 +51,7 @@ #if defined (HAVE_CURL) #include <curl/curl.h> +#include <curl/curlver.h> #include <curl/types.h> #include <curl/easy.h> @@ -559,10 +560,23 @@ setopt (CURLOPT_NOBODY, 1); // Set the username and password +#if (LIBCURL_VERSION_NUM >= 0x071300) + // This is possible since cURL 7.19. if (user.length () != 0) setopt (CURLOPT_USERNAME, user.c_str()); if (passwd.length () != 0) setopt (CURLOPT_PASSWORD, passwd.c_str()); +#else + // Probably needs to be static to remain valid long enough. + static std::string userpwd; + if (user.length () != 0) + { + userpwd = user; + if (passwd.length () != 0) + userpwd += ':' + passwd; + setopt (CURLOPT_USERPWD, userpwd.c_str ()); + } +#endif // Define our callback to get called when there's data to be written. setopt (CURLOPT_WRITEFUNCTION, write_data);