ScummVM API documentation
Networking::CurlRequest Class Reference
Inheritance diagram for Networking::CurlRequest:
Networking::Request Networking::CurlJsonRequest Networking::SessionRequest Cloud::Box::BoxTokenRefresher Cloud::Dropbox::DropboxTokenRefresher Cloud::GoogleDrive::GoogleDriveTokenRefresher Cloud::OneDrive::OneDriveTokenRefresher

Public Member Functions

 CurlRequest (DataCallback cb, ErrorCallback ecb, const Common::String &url)
 
void handle () override
 
void restart () override
 
Common::String date () const override
 
virtual void setHeaders (const Common::Array< Common::String > &headers)
 
virtual void addHeader (const Common::String &header)
 
virtual void addPostField (const Common::String &field)
 
virtual void addFormField (const Common::String &name, const Common::String &value)
 
virtual void addFormFile (const Common::String &name, const Common::Path &filename)
 
virtual void setBuffer (byte *buffer, uint32 size)
 
virtual void usePut ()
 
virtual void usePatch ()
 
virtual void connectionKeepAlive (long idle=120, long interval=60)
 
virtual void connectionClose ()
 
virtual NetworkReadStreamResponse execute ()
 
const NetworkReadStreamgetNetworkReadStream () const
 
void wait (int spinlockDelay=5)
 
- Public Member Functions inherited from Networking::Request
 Request (DataCallback cb, ErrorCallback ecb)
 
virtual void handleRetry ()
 
virtual void pause ()
 
virtual void finish ()
 
virtual void retry (uint32 seconds)
 
RequestState state () const
 

Protected Member Functions

NetworkReadStreammakeStream ()
 
- Protected Member Functions inherited from Networking::Request
virtual void finishError (const ErrorResponse &error, RequestState state=FINISHED)
 
virtual void finishSuccess ()
 

Protected Attributes

Common::String _url
 
NetworkReadStream_stream
 
curl_slist * _headersList
 
Common::String _postFields
 
Common::HashMap< Common::String, Common::String_formFields
 
Common::HashMap< Common::String, Common::Path_formFiles
 
byte * _bytesBuffer
 
uint32 _bytesBufferSize
 
bool _uploading
 
bool _usingPatch
 
bool _keepAlive
 
long _keepAliveIdle
 
long _keepAliveInterval
 
- Protected Attributes inherited from Networking::Request
DataCallback _callback
 
ErrorCallback _errorCallback
 
RequestState _state
 
uint32 _retryInSeconds
 

Member Function Documentation

◆ handle()

void Networking::CurlRequest::handle ( )
overridevirtual

Method, which does actual work. Depends on what this Request is doing.

Implements Networking::Request.

Reimplemented in Networking::SessionRequest.

◆ restart()

void Networking::CurlRequest::restart ( )
overridevirtual

Method, which is used to restart the Request.

Implements Networking::Request.

Reimplemented in Networking::SessionRequest.

◆ date()

Common::String Networking::CurlRequest::date ( ) const
overridevirtual

Return date this Request received from server. It could be extracted from "Date" header, which is kept in NetworkReadStream.

Note
not all Requests do that, so "" is returned to indicate the date is unknown. That's also true if no server response available or no "Date" header was passed.
Returns
date from "Date" response header.

Reimplemented from Networking::Request.

◆ setHeaders()

virtual void Networking::CurlRequest::setHeaders ( const Common::Array< Common::String > &  headers)
virtual

◆ addHeader()

virtual void Networking::CurlRequest::addHeader ( const Common::String header)
virtual

◆ addPostField()

virtual void Networking::CurlRequest::addPostField ( const Common::String field)
virtual

Adds a post field (key=value pair).

◆ addFormField()

virtual void Networking::CurlRequest::addFormField ( const Common::String name,
const Common::String value 
)
virtual

Adds a form/multipart field (name, value).

◆ addFormFile()

virtual void Networking::CurlRequest::addFormFile ( const Common::String name,
const Common::Path filename 
)
virtual

Adds a form/multipart file (field name, file name).

◆ setBuffer()

virtual void Networking::CurlRequest::setBuffer ( byte *  buffer,
uint32  size 
)
virtual

Sets bytes buffer.

◆ usePut()

virtual void Networking::CurlRequest::usePut ( )
virtual

Remembers to use PUT method when it would create NetworkReadStream.

◆ usePatch()

virtual void Networking::CurlRequest::usePatch ( )
virtual

Remembers to use PATCH method when it would create NetworkReadStream.

◆ connectionKeepAlive()

virtual void Networking::CurlRequest::connectionKeepAlive ( long  idle = 120,
long  interval = 60 
)
virtual

Remembers to use Connection: keep-alive or close.

◆ execute()

virtual NetworkReadStreamResponse Networking::CurlRequest::execute ( )
virtual

Starts this Request with ConnMan.

Returns
its NetworkReadStream in NetworkReadStreamResponse.

◆ getNetworkReadStream()

const NetworkReadStream* Networking::CurlRequest::getNetworkReadStream ( ) const

◆ wait()

void Networking::CurlRequest::wait ( int  spinlockDelay = 5)

Waits for Request to be processed. Should be called after Request is put into ConnMan.


The documentation for this class was generated from the following file: