comparison src/DLD-FUNCTIONS/urlwrite.cc @ 10377:fb62fbbe28c0

urlwrite: don't set CURLOPT_USERPWD if userpwd is empty
author David Bateman <dbateman@free.fr>
date Sun, 28 Feb 2010 23:27:09 -0500
parents 2d47356a7a1a
children 89f4d7e294cc
comparison
equal deleted inserted replaced
10376:1ed7cc046c52 10377:fb62fbbe28c0
561 561
562 // Set the username and password 562 // Set the username and password
563 std::string userpwd = user; 563 std::string userpwd = user;
564 if (! passwd.empty ()) 564 if (! passwd.empty ())
565 userpwd += ":" + passwd; 565 userpwd += ":" + passwd;
566 setopt (CURLOPT_USERPWD, userpwd.c_str ()); 566 if (! userpwd.empty ())
567 setopt (CURLOPT_USERPWD, userpwd.c_str ());
567 568
568 // Define our callback to get called when there's data to be written. 569 // Define our callback to get called when there's data to be written.
569 setopt (CURLOPT_WRITEFUNCTION, write_data); 570 setopt (CURLOPT_WRITEFUNCTION, write_data);
570 571
571 // Set a pointer to our struct to pass to the callback. 572 // Set a pointer to our struct to pass to the callback.