crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
crawlservpp::Network::FTPUpload Namespace Reference

Classes

struct  State
 Stores content and status of a FTP upload. More...
 

Functions

void write (const std::string &content, const std::string &url, const std::string &proxy=std::string{}, bool verbose=false)
 Writes data into a FTP file using the libcurl library. More...
 
std::size_t read (char *bufptr, std::size_t size, std::size_t nitems, void *userp)
 Custom reader function for FTP transfers. More...
 
void check (CURLcode code)
 Checks the result of a libcurl operation and throws an exception if an error occured. More...
 

Function Documentation

◆ check()

void crawlservpp::Network::FTPUpload::check ( CURLcode  code)
inline

Checks the result of a libcurl operation and throws an exception if an error occured.

Parameters
codeThe result code from to be checked.
Exceptions

Referenced by write().

◆ read()

std::size_t crawlservpp::Network::FTPUpload::read ( char *  bufptr,
std::size_t  size,
std::size_t  nitems,
void *  userp 
)
inline

Custom reader function for FTP transfers.

Parameters
bufptrPointer to the buffer to write to.
sizeSize of each item to be written.
nitemsNumber of items to be written.
userpPointer to the state of the FTP operation.
See also
State

References crawlservpp::Network::FTPUpload::State::size.

Referenced by write().

◆ write()

void crawlservpp::Network::FTPUpload::write ( const std::string &  content,
const std::string &  url,
const std::string &  proxy = std::string{},
bool  verbose = false 
)
inline

Writes data into a FTP file using the libcurl library.

Parameters
contentConstant reference to the content that should be written to the new file.
urlConstant reference to a string containing the URL including protocol. If the FTP server requires authentification, it needs to be included into the URL as follows: ftp[s]://username:passw.nosp@m.ord@.nosp@m.examp.nosp@m.le.c.nosp@m.om
proxyConstant reference to a string containing the URL of the proxy server to be used. If the string is empty, no proxy server will be used.

References check(), crawlservpp::Network::FTPUpload::State::content, crawlservpp::Wrapper::Curl::get(), read(), crawlservpp::Network::FTPUpload::State::size, and crawlservpp::Wrapper::Curl::valid().

Referenced by crawlservpp::Module::Analyzer::Thread::uploadResult().