logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

ost::URLStream - A URL processing version of TCPStream.

Author

       Generated automatically by Doxygen for GNU CommonC++ from the source code.

GNU CommonC++                                    Sun Dec 27 2020                               ost::URLStream(3)

Constructor & Destructor Documentation

ost::URLStream::URLStream(Familyfamily=IPV4,timeout_ttimer=0)
       Construct an instance of URL stream.

       Parametersfamily protocol to use.
           timer for default timeout on I/O operations.

Detailed Description

       A URL processing version of TCPStream.

       Author
           David Sugar dyfet@ostel.com

       C++ url processing stream class.

       Examplesurlfetch.cpp, and xmlfetch.cpp.

Member Data Documentation

ost::Stringost::URLStream::m_address[protected]ost::Stringost::URLStream::m_host[protected]

Member Enumeration Documentation

enumost::URLStream::Authentication
       Type of authentication.

       EnumeratorauthAnonymousauthBasicenumost::URLStream::Encoding
       Encoding used in transfer.

       EnumeratorencodingBinaryencodingChunkedenumost::URLStream::Error
       Return error for url fetch.

       EnumeratorerrSuccesserrUnreachableerrMissingerrDeniederrInvaliderrForbiddenerrUnauthorizederrRelocatederrFailureerrTimeouterrInterfaceenumost::URLStream::Method
       Type of fetch.

       EnumeratormethodHttpGetmethodHttpPutmethodHttpPostmethodHttpPostMultipartmethodFtpGetmethodFtpPutmethodFileGetmethodFilePutenumost::URLStream::Protocol
       http protocol version

       EnumeratorprotocolHttp1_0protocolHttp1_1

Member Function Documentation

virtualintost::URLStream::aRead(char*buffer,size_tlen,timeout_ttimer)[protected],[virtual]
       Derived method for async or timed I/O function on url stream.

       Returns
           number of bytes read or < 0 for error.

       Parametersbuffer to read stream data into.
           len of bytes to read from stream.
           timer to wait for data in milliseconds.

   virtualintost::URLStream::aWrite(char*buffer,size_tlen,timeout_ttimer)[protected],[virtual]
       Derived method for async or timed I/O function on url stream.

       Returns
           number of bytes written or < 0 for error.

       Parametersbuffer to write stream data from.
           len of bytes to write to stream.
           timer to wait for data in milliseconds.

   voidost::URLStream::close()
       Close the URL stream for a new connection.

   virtualchar**ost::URLStream::extraHeader(void)[protected],[virtual]
       A virtual to insert additional header info into the request.

       Returns
           array of header attributes to add.

   Errorost::URLStream::get(constchar*url,size_tbuffer=512)
       Get URL data from a named stream of a known buffer size.

       Returns
           url error code.

       Parametersurl name of resource.
           buffer size of buffer.

   Errorost::URLStream::get(size_tbuffer=512)
       Get  URL  data  from  a  named stream of a known buffer size. Requesting URL defined in previous calls of
       setAddress() and setHost() functions.

       Returns
           url error code.

       Parametersbuffer size of buffer.

   URLStream&ost::URLStream::getline(char*buffer,size_tlen)
       Line parsing with conversion.

       ReturnsURLStream object reference.

       Parametersbuffer to store.
           len maximum buffer size.

   Methodost::URLStream::getMethod(void)[inline]
       Get url method (and protocol) employed.

       Returns
           url method in effect.

   Errorost::URLStream::head(constchar*url,size_tbuffer=512)
       Used to fetch header information for a resource.

       Returns
           url error code.

       Parametersurl name of resource.
           buffer size of buffer.

   virtualvoidost::URLStream::httpHeader(constchar*header,constchar*value)[protected],[virtual]
       Derived method to receive and parse http 'headers'.

       Parametersheader keyword.
           value header keyword value.

   Errorost::URLStream::post(constchar*url,constchar**vars,size_tbuffer=512)
       Post URL vars with post method.

       Returns
           success or error code.

       Parametersurl name of resource being posted.
           vars to set in post.
           buffer size of buffer.

   Errorost::URLStream::post(constchar*url,MIMEMultipartForm&form,size_tbuffer=512)
       Post URL with MIME multipart form.

       Returns
           success or error code.

       Parametersurl name of resource being posted.
           form multi-part resource.
           buffer size to use.

   Errorost::URLStream::sendHTTPHeader(constchar*url,constchar**vars,size_tbufsize)[protected]
       Send http header to server.

       Parametersurl base to send header to
           vars to post or use in get method
           bufsize of stream buffering to use

       Returns
           success or class error

   voidost::URLStream::setAddress(constchar*str)[inline]
       Set the address for the url.

       Parametersstr address in the URL.

   voidost::URLStream::setAgent(constchar*str)[inline]
       Set the agent.

       Parametersstr agent value.

   voidost::URLStream::setAuthentication(Authenticationa,constchar*str=NULL)
       Set authentication type for the url.

       Parametersa authentication.
           str string.

   voidost::URLStream::setCookie(constchar*str)[inline]
       Set the cookie to pass.

       Parametersstr cookie string.

   voidost::URLStream::setFollow(boolenable)[inline]
       Specify url following. Set to false to disable following of relocation requests.

       Parametersenable true to enable following.

   voidost::URLStream::setHost(constchar*str)[inline]
       Set the host for the url.

       Parametersstr host address.

   voidost::URLStream::setLocalInterface(constchar*intf)[inline]
       Specify local interface to use.

       Parametersintf Local interface name

   voidost::URLStream::setPassword(constchar*str)[inline]
       Set password for the url.

       Parametersstr password.

   voidost::URLStream::setPragma(constchar*str)[inline]
       Set the pragmas.

       Parametersstr pragma setting.

   voidost::URLStream::setProtocol(Protocolpro)[inline]
       Specify http protocol level being used.

       Parameterspro protocol level.

   voidost::URLStream::setProxy(constchar*host,tpport_tport)
       Set the proxy server used.

       Parametershost proxy host.
           port proxy port.

   voidost::URLStream::setProxyAuthentication(Authenticationa,constchar*str=NULL)
       Set proxy authentication type for the url.

       Parametersa authentication.
           str string.

   voidost::URLStream::setProxyPassword(constchar*str)[inline]
       Set proxy password for the url.

       Parametersstr password.

   voidost::URLStream::setProxyUser(constchar*str)[inline]
       Set proxy user id for the url.

       Parametersstr user id.

   voidost::URLStream::setReferer(constchar*str)
       Set the referer url.

       Parametersstr referer string.

   voidost::URLStream::setTimeout(timeout_tto)[inline]
       Set socket timeout characteristics for processing URL requests. Set to 0 for no default timeouts.

       Parametersto timeout to set.

   voidost::URLStream::setUser(constchar*str)[inline]
       Set user id for the url.

       Parametersstr user id.

   Errorost::URLStream::submit(constchar*url,constchar**vars,size_tbuffer=512)
       Submit URL with vars passed as argument array. This submit assumes 'GET' method.  Use  'post'  member  to
       perform post.

       Returns
           url error code.

       Parametersurl name of resource.
           vars to set.
           buffer size of buffer.

   intost::URLStream::underflow(void)[protected]
       Called if stream buffer needs refilling.

       Returns
           number of bytes refilled or error if < 0

Name

       ost::URLStream - A URL processing version of TCPStream.

Synopsis

       #include <url.h>

       Inherits ost::TCPStream.

   PublicTypes
       enum Error { errSuccess = 0, errUnreachable, errMissing, errDenied, errInvalid, errForbidden,
           errUnauthorized, errRelocated, errFailure, errTimeout, errInterface }
           Return error for url fetch.
       enum Authentication { authAnonymous = 0, authBasic }
           Type of authentication.
       enum Encoding { encodingBinary = 0, encodingChunked }
           Encoding used in transfer.
       enum Method { methodHttpGet, methodHttpPut, methodHttpPost, methodHttpPostMultipart, methodFtpGet,
           methodFtpPut, methodFileGet, methodFilePut }
           Type of fetch.
       enum Protocol { protocolHttp1_0, protocolHttp1_1 }
           http protocol version

   PublicMemberFunctionsURLStream (Familyfamily=IPV4, timeout_t timer=0)
           Construct an instance of URL stream.
       URLStream & getline (char *buffer, size_t len)
           Line parsing with conversion.
       Errorget (const char *url, size_t buffer=512)
           Get URL data from a named stream of a known buffer size.
       Errorget (size_t buffer=512)
           Get URL data from a named stream of a known buffer size.
       Errorsubmit (const char *url, const char **vars, size_t buffer=512)
           Submit URL with vars passed as argument array.
       Errorpost (const char *url, const char **vars, size_t buffer=512)
           Post URL vars with post method.
       Errorpost (const char *url, MIMEMultipartForm &form, size_t buffer=512)
           Post URL with MIME multipart form.
       Errorhead (const char *url, size_t buffer=512)
           Used to fetch header information for a resource.
       void close ()
           Close the URL stream for a new connection.
       void setReferer (const char *str)
           Set the referer url.
       void setHost (const char *str)
           Set the host for the url.
       void setAddress (const char *str)
           Set the address for the url.
       void setCookie (const char *str)
           Set the cookie to pass.
       void setUser (const char *str)
           Set user id for the url.
       void setPassword (const char *str)
           Set password for the url.
       void setAuthentication (Authentication a, const char *str=NULL)
           Set authentication type for the url.
       void setProxyUser (const char *str)
           Set proxy user id for the url.
       void setProxyPassword (const char *str)
           Set proxy password for the url.
       void setProxyAuthentication (Authentication a, const char *str=NULL)
           Set proxy authentication type for the url.
       void setPragma (const char *str)
           Set the pragmas.
       void setProxy (const char *host, tpport_t port)
           Set the proxy server used.
       void setAgent (const char *str)
           Set the agent.
       MethodgetMethod (void)
           Get url method (and protocol) employed.
       void setTimeout (timeout_t to)
           Set socket timeout characteristics for processing URL requests.
       void setFollow (bool enable)
           Specify url following.
       void setProtocol (Protocol pro)
           Specify http protocol level being used.
       void setLocalInterface (const char *intf)
           Specify local interface to use.

   ProtectedMemberFunctionsErrorsendHTTPHeader (const char *url, const char **vars, size_t bufsize)
           Send http header to server.
       int underflow (void)
           Called if stream buffer needs refilling.
       virtual int aRead (char *buffer, size_t len, timeout_t timer)
           Derived method for async or timed I/O function on url stream.
       virtual int aWrite (char *buffer, size_t len, timeout_t timer)
           Derived method for async or timed I/O function on url stream.
       virtual void httpHeader (const char *header, const char *value)
           Derived method to receive and parse http 'headers'.
       virtual char ** extraHeader (void)
           A virtual to insert additional header info into the request.

   ProtectedAttributesost::Stringm_hostost::Stringm_addressRelatedFunctions
       (Note that these are not member functions.)
       __EXPORT char * urlDecode (char *source, char *dest=NULL)
           Decode an url parameter (ie '20' -> ' ')
       __EXPORT char * urlEncode (const char *source, char *dest, size_t size)
           Encode an url parameter (ie ' ' -> '+')
       __EXPORT char * b64Decode (char *src, char *dest=NULL)
           Decode a string using base64 coding.
       __EXPORT char * b64Encode (const char *source, char *dest, size_t size)
           Encode a string using base64 coding.
       __EXPORT size_t b64Encode (const unsigned char *src, size_t srcsize, char *dst, size_t dstsize)
           Encode a octet stream using base64 coding.
       __EXPORT size_t b64Decode (const char *src, unsigned char *dst, size_t dstsize)
           Decode a string using base64 coding.
       __EXPORTStringb64Encode (const String &src)
           Encode a STL string using base64 coding into a STL string.
       __EXPORTStringb64Decode (const String &src)
           Decode a STL string using base64 coding into an STL String.
       __EXPORTStringb64Encode (const unsigned char *src, size_t srcsize)
           Encode a octet stream using base64 coding into a STL string.
       __EXPORT size_t b64Decode (const String &src, unsigned char *dst, size_t dstsize)
           Decode a string using base64 coding.

   AdditionalInheritedMembers

See Also