Mercurial > hg > octave-nkf
changeset 17614:ce7b9abf6600
Keep a copy of url string for older cURL libraries
* url-transfer.cc (curl_transfer::url): New data member.
(curl_transfer::curl_transfer): Initialize it.
(curl_transfer::curl_transfer, curl_transfer::put, curl_transfer::get,
curl_transfer::dir, curl_transfer::list, curl_transfer::get_fileinfo,
curl_transfer::http_get): Set it to requested url.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Wed, 09 Oct 2013 01:10:14 -0400 |
parents | 6b8df90c8806 |
children | 3a7d5d655749 |
files | liboctave/util/url-transfer.cc |
diffstat | 1 files changed, 12 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/util/url-transfer.cc +++ b/liboctave/util/url-transfer.cc @@ -276,7 +276,8 @@ public: curl_transfer (void) - : base_url_transfer (), curl (curl_easy_init ()), errnum (), userpwd () + : base_url_transfer (), curl (curl_easy_init ()), errnum (), url (), + userpwd () { if (curl) valid = true; @@ -287,7 +288,7 @@ curl_transfer (const std::string& host, const std::string& user_arg, const std::string& passwd, std::ostream& os) : base_url_transfer (host, user_arg, passwd, os), - curl (curl_easy_init ()), errnum (), userpwd () + curl (curl_easy_init ()), errnum (), url (), userpwd () { if (curl) valid = true; @@ -299,7 +300,7 @@ init (user_arg, passwd, std::cin, os); - std::string url ("ftp://" + host); + url = "ftp://" + host; SETOPT (CURLOPT_URL, url.c_str ()); // Set up the link, with no transfer. @@ -308,7 +309,7 @@ curl_transfer (const std::string& url, std::ostream& os) : base_url_transfer (url, os), curl (curl_easy_init ()), errnum (), - userpwd () + url (), userpwd () { if (curl) valid = true; @@ -425,7 +426,7 @@ void put (const std::string& file, std::istream& is) { - std::string url = "ftp://" + host_or_url + "/" + file; + url = "ftp://" + host_or_url + "/" + file; SETOPT (CURLOPT_URL, url.c_str ()); SETOPT (CURLOPT_UPLOAD, 1); SETOPT (CURLOPT_NOBODY, 0); @@ -444,7 +445,7 @@ void get (const std::string& file, std::ostream& os) { - std::string url = "ftp://" + host_or_url + "/" + file; + url = "ftp://" + host_or_url + "/" + file; SETOPT (CURLOPT_URL, url.c_str ()); SETOPT (CURLOPT_NOBODY, 0); std::ostream& old_os = set_ostream (os); @@ -461,7 +462,7 @@ void dir (void) { - std::string url = "ftp://" + host_or_url + "/"; + url = "ftp://" + host_or_url + "/"; SETOPT (CURLOPT_URL, url.c_str ()); SETOPT (CURLOPT_NOBODY, 0); @@ -479,7 +480,7 @@ string_vector retval; std::ostringstream buf; - std::string url = "ftp://" + host_or_url + "/"; + url = "ftp://" + host_or_url + "/"; SETOPTR (CURLOPT_WRITEDATA, static_cast<void*> (&buf)); SETOPTR (CURLOPT_URL, url.c_str ()); SETOPTR (CURLOPT_DIRLISTONLY, 1); @@ -527,7 +528,7 @@ { std::string path = pwd (); - std::string url = "ftp://" + host_or_url + "/" + path + "/" + filename; + url = "ftp://" + host_or_url + "/" + path + "/" + filename; SETOPT (CURLOPT_URL, url.c_str ()); SETOPT (CURLOPT_FILETIME, 1); SETOPT (CURLOPT_HEADERFUNCTION, throw_away); @@ -605,7 +606,7 @@ void http_get (const Array<std::string>& param) { - std::string url = host_or_url; + url = host_or_url; std::string query_string = form_query_string (param); @@ -662,6 +663,7 @@ // the handle is released. The curl_handle::curl_handle_rep class // contains the pointer to the CURL handle and so is the best // candidate for storing the strings as well. (bug #36717) + std::string url; std::string userpwd; // No copying!