BinaryNinja::Http Namespace Reference

Classes

struct  MultipartField
 Structure for multipart form fields. More...
 
struct  Request
 Structure containing HTTP metadata for requests. More...
 
struct  RequestContext
 
struct  Response
 Basic HTTP response structure. More...
 

Enumerations

enum  ResponseCode {
  Continue = 100 , SwitchingProtocols = 101 , OK = 200 , Created = 201 ,
  Accepted = 202 , NonAuthoritativeInformation = 203 , NoContent = 204 , ResetContent = 205 ,
  PartialContent = 206 , MultipleChoices = 300 , MovedPermanently = 301 , Found = 302 ,
  SeeOther = 303 , NotModified = 304 , UseProxy = 305 , TemporaryRedirect = 307 ,
  BadRequest = 400 , Unauthorized = 401 , PaymentRequired = 402 , Forbidden = 403 ,
  NotFound = 404 , MethodNotAllowed = 405 , NotAcceptable = 406 , ProxyAuthenticationRequired = 407 ,
  RequestTimeout = 408 , Conflict = 409 , Gone = 410 , LengthRequired = 411 ,
  PreconditionFailed = 412 , RequestEntityTooLarge = 413 , RequestURITooLong = 414 , UnsupportedMediaType = 415 ,
  RequestedRangeNotSatisfiable = 416 , ExpectationFailed = 417 , ImATeapot = 418 , InternalServerError = 500 ,
  NotImplemented = 501 , BadGateway = 502 , ServiceUnavailable = 503 , GatewayTimeout = 504 ,
  HTTPVersionNotSupported = 505
}
 

Functions

int64_t HttpReadCallback (uint8_t *data, uint64_t len, void *ctxt)
 
uint64_t HttpWriteCallback (uint8_t *data, uint64_t len, void *ctxt)
 
string UrlEncode (const string &str)
 
string UrlEncode (const vector< pair< string, string > > &fields)
 
vector< uint8_t > MultipartEncode (const vector< MultipartField > &fields, string &boundary)
 
int Perform (const Ref< DownloadInstance > &instance, const Request &request, Response &response)
 Perform an HTTP request as specified by a Request, storing results in a Response. More...
 
std::string UrlEncode (const std::string &str)
 Convert a string to a URLEncoded form-field safe form. More...
 
std::string UrlEncode (const std::vector< std::pair< std::string, std::string > > &fields)
 Convert a list of key/value pair strings into a URLEncoded form body. More...
 
std::vector< uint8_t > MultipartEncode (const std::vector< MultipartField > &fields, std::string &boundary)
 Convert a list of form fields (potentially containing binary data) into a multipart encoded form body. More...
 

Enumeration Type Documentation

◆ ResponseCode

Enumerator
Continue 
SwitchingProtocols 
OK 
Created 
Accepted 
NonAuthoritativeInformation 
NoContent 
ResetContent 
PartialContent 
MultipleChoices 
MovedPermanently 
Found 
SeeOther 
NotModified 
UseProxy 
TemporaryRedirect 
BadRequest 
Unauthorized 
PaymentRequired 
Forbidden 
NotFound 
MethodNotAllowed 
NotAcceptable 
ProxyAuthenticationRequired 
RequestTimeout 
Conflict 
Gone 
LengthRequired 
PreconditionFailed 
RequestEntityTooLarge 
RequestURITooLong 
UnsupportedMediaType 
RequestedRangeNotSatisfiable 
ExpectationFailed 
ImATeapot 
InternalServerError 
NotImplemented 
BadGateway 
ServiceUnavailable 
GatewayTimeout 
HTTPVersionNotSupported 

Function Documentation

◆ HttpReadCallback()

int64_t BinaryNinja::Http::HttpReadCallback ( uint8_t *  data,
uint64_t  len,
void *  ctxt 
)

◆ HttpWriteCallback()

uint64_t BinaryNinja::Http::HttpWriteCallback ( uint8_t *  data,
uint64_t  len,
void *  ctxt 
)

◆ UrlEncode() [1/4]

string BinaryNinja::Http::UrlEncode ( const string &  str)

◆ UrlEncode() [2/4]

string BinaryNinja::Http::UrlEncode ( const vector< pair< string, string > > &  fields)

◆ MultipartEncode() [1/2]

vector< uint8_t > BinaryNinja::Http::MultipartEncode ( const vector< MultipartField > &  fields,
string &  boundary 
)

◆ Perform()

int BinaryNinja::Http::Perform ( const Ref< DownloadInstance > &  instance,
const Request request,
Response response 
)

Perform an HTTP request as specified by a Request, storing results in a Response.

Parameters
instanceDownloadInstance instance
requestInput Request structure with fields
responseOutput Response structure with body
Returns
Zero or greater on success

◆ UrlEncode() [3/4]

std::string BinaryNinja::Http::UrlEncode ( const std::string &  str)

Convert a string to a URLEncoded form-field safe form.

Parameters
strInput string
Returns
URLEncoded string

◆ UrlEncode() [4/4]

std::string BinaryNinja::Http::UrlEncode ( const std::vector< std::pair< std::string, std::string > > &  fields)

Convert a list of key/value pair strings into a URLEncoded form body.

Parameters
fieldsInput key/value pairs
Returns
URLEncoded form body

◆ MultipartEncode() [2/2]

std::vector< uint8_t > BinaryNinja::Http::MultipartEncode ( const std::vector< MultipartField > &  fields,
std::string &  boundary 
)

Convert a list of form fields (potentially containing binary data) into a multipart encoded form body.

Parameters
fieldsInput fields
boundaryOutput boundary between fields in the body (for Content-Type header)
Returns
Multipart encoded form body