# HG changeset patch # User Jaroslav Hajek # Date 1259477380 -3600 # Node ID dd3fc8ba479692b7562d8b9509e4585ce2b8e244 # Parent fed4aad2cdca289d9eed8a9da7747bbdd054ca52 support libcurl < 7.19 diff -r fed4aad2cdca -r dd3fc8ba4796 src/ChangeLog --- a/src/ChangeLog Sat Nov 28 15:46:10 2009 -0500 +++ b/src/ChangeLog Sun Nov 29 07:49:40 2009 +0100 @@ -1,3 +1,8 @@ +2009-11-29 Jaroslav Hajek + + * DLD-FUNCTIONS/urlwrite.cc (curl_handle::init): Use CURLOPT_USERPWD + if libcurl ver < 7.19.0. + 2009-11-28 Shai Ayal * gl-render.cc (opengl_renderer::draw_image): Handle indexed images. diff -r fed4aad2cdca -r dd3fc8ba4796 src/DLD-FUNCTIONS/urlwrite.cc --- a/src/DLD-FUNCTIONS/urlwrite.cc Sat Nov 28 15:46:10 2009 -0500 +++ b/src/DLD-FUNCTIONS/urlwrite.cc Sun Nov 29 07:49:40 2009 +0100 @@ -51,6 +51,7 @@ #if defined (HAVE_CURL) #include +#include #include #include @@ -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);