26 #if ! defined (octave_url_transfer_h)
27 #define octave_url_transfer_h 1
29 #include "octave-config.h"
38 template <
typename T>
class Array;
65 curl_xfer->
cwd (
"..");
91 bool good (
void)
const {
return m_valid && m_ok; }
95 virtual std::string
lasterror (
void)
const {
return m_errmsg; }
99 return *m_curr_ostream;
104 return *m_curr_istream;
111 bool is_ascii (
void)
const {
return m_ascii_mode; }
115 virtual void cwd (
const std::string& ) { }
117 virtual void del (
const std::string& ) { }
119 virtual void rmdir (
const std::string& ) { }
121 virtual void mkdir (
const std::string& ) { }
123 virtual void rename (
const std::string& ,
124 const std::string& ) { }
126 virtual void put (
const std::string& ,
129 virtual void get (
const std::string& ,
132 void mget_directory (
const std::string& directory,
133 const std::string& target);
136 const std::string& directory);
138 virtual void dir (
void) { }
147 virtual std::string
pwd (
void) {
return ""; }
154 const std::string& ) { }
185 url_transfer (
const std::string& host,
const std::string& user,
186 const std::string& passwd, std::ostream& os);
188 url_transfer (
const std::string& url, std::ostream& os);
196 bool is_valid (
void)
const {
return m_rep->is_valid (); }
198 bool good (
void)
const {
return m_rep->good (); }
200 std::string
lasterror (
void)
const {
return m_rep->lasterror (); }
204 return m_rep->set_ostream (os);
209 return m_rep->set_istream (is);
212 void ascii (
void) { m_rep->ascii (); }
216 bool is_ascii (
void)
const {
return m_rep->is_ascii (); }
218 bool is_binary (
void)
const {
return m_rep->is_binary (); }
222 void del (
const std::string& file) { m_rep->del (file); }
228 void rename (
const std::string& oldname,
const std::string& newname)
230 m_rep->rename (oldname, newname);
233 void put (
const std::string& file, std::istream& is)
235 m_rep->put (file, is);
238 void get (
const std::string& file, std::ostream& os)
240 m_rep->get (file, os);
244 const std::string& target)
246 m_rep->mget_directory (directory, target);
250 const std::string& directory)
252 return m_rep->mput_directory (base, directory);
255 void dir (
void) { m_rep->dir (); }
260 time_t& filetime,
bool& fileisdir)
262 m_rep->get_fileinfo (filename, filesize, filetime, fileisdir);
265 std::string
pwd (
void) {
return m_rep->pwd (); }
269 m_rep->http_get (param);
274 m_rep->http_post (param);
278 const std::string& action)
280 m_rep->http_action (param, action);
285 m_rep->cookie_jar (filename);
290 m_rep->set_header_fields (param);
295 m_rep->form_data_post (param);
300 m_rep->set_weboptions (param);
305 std::shared_ptr<base_url_transfer>
m_rep;
static void delete_file(const std::string &file)
N Dimensional Array with copy-on-write semantics.
virtual void http_get(const Array< std::string > &)
virtual void http_action(const Array< std::string > &, const std::string &)
virtual void mkdir(const std::string &)
virtual void del(const std::string &)
static void reset_path(base_url_transfer *curl_xfer)
virtual void binary(void)
virtual std::ostream & set_ostream(std::ostream &)
virtual void rename(const std::string &, const std::string &)
std::string m_host_or_url
virtual std::string lasterror(void) const
bool is_valid(void) const
std::ostream * m_curr_ostream
bool is_binary(void) const
virtual void cookie_jar(const std::string &)
virtual std::string pwd(void)
virtual void put(const std::string &, std::istream &)
virtual void set_weboptions(const struct weboptions &)
virtual void http_post(const Array< std::string > &)
base_url_transfer(const base_url_transfer &)=delete
std::istream * m_curr_istream
virtual void form_data_post(const Array< std::string > &)
virtual void get(const std::string &, std::ostream &)
virtual void perform(void)
virtual void cwd(const std::string &)
virtual void get_fileinfo(const std::string &, double &, time_t &, bool &)
bool is_ascii(void) const
virtual string_vector list(void)
virtual void rmdir(const std::string &)
virtual ~base_url_transfer(void)=default
virtual std::istream & set_istream(std::istream &)
virtual void set_header_fields(const Array< std::string > &)
void mget_directory(const std::string &directory, const std::string &target)
std::string lasterror(void) const
std::istream & set_istream(std::istream &is)
void cwd(const std::string &path)
string_vector mput_directory(const std::string &base, const std::string &directory)
void set_header_fields(const Array< std::string > ¶m)
void http_get(const Array< std::string > ¶m)
bool is_binary(void) const
void form_data_post(const Array< std::string > ¶m)
std::shared_ptr< base_url_transfer > m_rep
void rename(const std::string &oldname, const std::string &newname)
void http_action(const Array< std::string > ¶m, const std::string &action)
bool is_valid(void) const
void mkdir(const std::string &path)
bool is_ascii(void) const
void rmdir(const std::string &path)
std::ostream & set_ostream(std::ostream &os)
void put(const std::string &file, std::istream &is)
~url_transfer(void)=default
void cookie_jar(const std::string &filename)
void del(const std::string &file)
void get(const std::string &file, std::ostream &os)
void http_post(const Array< std::string > ¶m)
void get_fileinfo(const std::string &filename, double &filesize, time_t &filetime, bool &fileisdir)
void set_weboptions(const struct weboptions ¶m)
url_transfer(const url_transfer &)=default
std::string RequestMethod
std::string ContentReader
Array< std::string > HeaderFields
std::string CertificateFilename