BinaryNinja::Http::Request Struct Reference

Structure containing HTTP metadata for requests. More...

Detailed Description

Structure containing HTTP metadata for requests.

Public Member Functions

 Request (std::string method, std::string url, std::unordered_map< std::string, std::string > headers={}, std::vector< std::pair< std::string, std::string > > params={}, std::function< bool(size_t, size_t)> downloadProgress={}, std::function< bool(size_t, size_t)> uploadProgress={})
 Construct an arbitrary HTTP request with an empty body. More...
 
 Request (std::string method, std::string url, std::unordered_map< std::string, std::string > headers, std::vector< std::pair< std::string, std::string > > params, std::vector< uint8_t > body, std::function< bool(size_t, size_t)> downloadProgress={}, std::function< bool(size_t, size_t)> uploadProgress={})
 Construct an arbitrary HTTP request with a binary data body. More...
 
 Request (std::string method, std::string url, std::unordered_map< std::string, std::string > headers, std::vector< std::pair< std::string, std::string > > params, std::vector< std::pair< std::string, std::string > > formFields, std::function< bool(size_t, size_t)> downloadProgress={}, std::function< bool(size_t, size_t)> uploadProgress={})
 Construct an arbitrary HTTP request with url encoded form fields as the body. More...
 
 Request (std::string method, std::string url, std::unordered_map< std::string, std::string > headers, std::vector< std::pair< std::string, std::string > > params, std::vector< MultipartField > formFields, std::function< bool(size_t, size_t)> downloadProgress={}, std::function< bool(size_t, size_t)> uploadProgress={})
 Construct an arbitrary HTTP request with Multipart encoded form fields as the body. More...
 

Static Public Member Functions

static Request Get (std::string url, std::unordered_map< std::string, std::string > headers={}, std::vector< std::pair< std::string, std::string > > params={}, std::function< bool(size_t, size_t)> downloadProgress={}, std::function< bool(size_t, size_t)> uploadProgress={})
 Construct an HTTP GET request. More...
 
static Request Post (std::string url, std::unordered_map< std::string, std::string > headers={}, std::vector< std::pair< std::string, std::string > > params={}, std::vector< uint8_t > body={}, std::function< bool(size_t, size_t)> downloadProgress={}, std::function< bool(size_t, size_t)> uploadProgress={})
 Construct an HTTP POST request with a binary data body. More...
 
static Request Post (std::string url, std::unordered_map< std::string, std::string > headers, std::vector< std::pair< std::string, std::string > > params, std::vector< std::pair< std::string, std::string > > formFields, std::function< bool(size_t, size_t)> downloadProgress={}, std::function< bool(size_t, size_t)> uploadProgress={})
 Construct an HTTP POST request with url encoded form fields as the body. More...
 
static Request Post (std::string url, std::unordered_map< std::string, std::string > headers, std::vector< std::pair< std::string, std::string > > params, std::vector< MultipartField > formFields, std::function< bool(size_t, size_t)> downloadProgress={}, std::function< bool(size_t, size_t)> uploadProgress={})
 Construct an HTTP POST request with Multipart encoded form fields as the body. More...
 

Public Attributes

std::string m_method
 
std::string m_url
 
std::unordered_map< std::string, std::string > m_headers
 
std::vector< uint8_t > m_body
 
std::function< bool(size_t, size_t)> m_downloadProgress
 
std::function< bool(size_t, size_t)> m_uploadProgress
 

Constructor & Destructor Documentation

◆ Request() [1/4]

BinaryNinja::Http::Request::Request ( std::string  method,
std::string  url,
std::unordered_map< std::string, std::string >  headers = {},
std::vector< std::pair< std::string, std::string > >  params = {},
std::function< bool(size_t, size_t)>  downloadProgress = {},
std::function< bool(size_t, size_t)>  uploadProgress = {} 
)

Construct an arbitrary HTTP request with an empty body.

Parameters
methodRequest method eg GET
urlTarget URL eg https://binary.ninja
headersHeader keys/values
paramsQuery parameters, keys/values
downloadProgressFunction to call for download progress updates
uploadProgressFunction to call for upload progress updates

◆ Request() [2/4]

BinaryNinja::Http::Request::Request ( std::string  method,
std::string  url,
std::unordered_map< std::string, std::string >  headers,
std::vector< std::pair< std::string, std::string > >  params,
std::vector< uint8_t >  body,
std::function< bool(size_t, size_t)>  downloadProgress = {},
std::function< bool(size_t, size_t)>  uploadProgress = {} 
)

Construct an arbitrary HTTP request with a binary data body.

Parameters
methodRequest method eg GET
urlTarget URL eg https://binary.ninja
headersHeader keys/values
paramsQuery parameters, keys/values
bodyContent body (binary data)
downloadProgressFunction to call for download progress updates
uploadProgressFunction to call for upload progress updates

◆ Request() [3/4]

BinaryNinja::Http::Request::Request ( std::string  method,
std::string  url,
std::unordered_map< std::string, std::string >  headers,
std::vector< std::pair< std::string, std::string > >  params,
std::vector< std::pair< std::string, std::string > >  formFields,
std::function< bool(size_t, size_t)>  downloadProgress = {},
std::function< bool(size_t, size_t)>  uploadProgress = {} 
)

Construct an arbitrary HTTP request with url encoded form fields as the body.

Parameters
methodRequest method eg GET
urlTarget URL eg https://binary.ninja
headersHeader keys/values
paramsQuery parameters, keys/values
formFieldsHTTP form fields, keys/values (both must be strings)
downloadProgressFunction to call for download progress updates
uploadProgressFunction to call for upload progress updates

◆ Request() [4/4]

BinaryNinja::Http::Request::Request ( std::string  method,
std::string  url,
std::unordered_map< std::string, std::string >  headers,
std::vector< std::pair< std::string, std::string > >  params,
std::vector< MultipartField formFields,
std::function< bool(size_t, size_t)>  downloadProgress = {},
std::function< bool(size_t, size_t)>  uploadProgress = {} 
)

Construct an arbitrary HTTP request with Multipart encoded form fields as the body.

Parameters
methodRequest method eg GET
urlTarget URL eg https://binary.ninja
headersHeader keys/values
paramsQuery parameters, keys/values
formFieldsHTTP form fields, keys/values (values can be arbitrary data)
downloadProgressFunction to call for download progress updates
uploadProgressFunction to call for upload progress updates

Member Function Documentation

◆ Get()

Request BinaryNinja::Http::Request::Get ( std::string  url,
std::unordered_map< std::string, std::string >  headers = {},
std::vector< std::pair< std::string, std::string > >  params = {},
std::function< bool(size_t, size_t)>  downloadProgress = {},
std::function< bool(size_t, size_t)>  uploadProgress = {} 
)
static

Construct an HTTP GET request.

Parameters
urlTarget URL eg https://binary.ninja
headersHeader keys/values
paramsQuery parameters, keys/values
downloadProgressFunction to call for download progress updates
uploadProgressFunction to call for upload progress updates
Returns
Request structure with specified fields

◆ Post() [1/3]

static Request BinaryNinja::Http::Request::Post ( std::string  url,
std::unordered_map< std::string, std::string >  headers = {},
std::vector< std::pair< std::string, std::string > >  params = {},
std::vector< uint8_t >  body = {},
std::function< bool(size_t, size_t)>  downloadProgress = {},
std::function< bool(size_t, size_t)>  uploadProgress = {} 
)
static

Construct an HTTP POST request with a binary data body.

Parameters
urlTarget URL eg https://binary.ninja
headersHeader keys/values
paramsQuery parameters, keys/values
bodyRequest body data
downloadProgressFunction to call for download progress updates
uploadProgressFunction to call for upload progress updates
Returns
Request structure with specified fields

◆ Post() [2/3]

static Request BinaryNinja::Http::Request::Post ( std::string  url,
std::unordered_map< std::string, std::string >  headers,
std::vector< std::pair< std::string, std::string > >  params,
std::vector< std::pair< std::string, std::string > >  formFields,
std::function< bool(size_t, size_t)>  downloadProgress = {},
std::function< bool(size_t, size_t)>  uploadProgress = {} 
)
static

Construct an HTTP POST request with url encoded form fields as the body.

Parameters
urlTarget URL eg https://binary.ninja
headersHeader keys/values
paramsQuery parameters, keys/values
formFieldsHTTP form fields, keys/values (both must be strings)
downloadProgressFunction to call for download progress updates
uploadProgressFunction to call for upload progress updates
Returns
Request structure with specified fields

◆ Post() [3/3]

static Request BinaryNinja::Http::Request::Post ( std::string  url,
std::unordered_map< std::string, std::string >  headers,
std::vector< std::pair< std::string, std::string > >  params,
std::vector< MultipartField formFields,
std::function< bool(size_t, size_t)>  downloadProgress = {},
std::function< bool(size_t, size_t)>  uploadProgress = {} 
)
static

Construct an HTTP POST request with Multipart encoded form fields as the body.

Parameters
urlTarget URL eg https://binary.ninja
headersHeader keys/values
paramsQuery parameters, keys/values
formFieldsHTTP form fields, keys/values (values can be arbitrary data)
downloadProgressFunction to call for download progress updates
uploadProgressFunction to call for upload progress updates
Returns
Request structure with specified fields

Member Data Documentation

◆ m_method

std::string BinaryNinja::Http::Request::m_method

◆ m_url

std::string BinaryNinja::Http::Request::m_url

◆ m_headers

std::unordered_map< std::string , std::string > BinaryNinja::Http::Request::m_headers

◆ m_body

std::vector<uint8_t> BinaryNinja::Http::Request::m_body

◆ m_downloadProgress

std::function<bool(size_t, size_t)> BinaryNinja::Http::Request::m_downloadProgress

◆ m_uploadProgress

std::function<bool(size_t, size_t)> BinaryNinja::Http::Request::m_uploadProgress