Apache Mesos
Namespaces | Classes | Enumerations | Functions | Variables
process::http Namespace Reference

Namespaces

 authentication
 
 authorization
 
 header
 
 internal
 
 path
 
 query
 
 streaming
 

Classes

struct  URL
 
struct  CaseInsensitiveHash
 
struct  CaseInsensitiveEqual
 
struct  Status
 
class  Pipe
 
class  Headers
 
struct  Request
 
struct  Response
 
struct  OK
 
struct  Accepted
 
struct  TemporaryRedirect
 
struct  BadRequest
 
struct  Unauthorized
 
struct  Forbidden
 
struct  NotFound
 
struct  MethodNotAllowed
 
struct  NotAcceptable
 
struct  Conflict
 
struct  PreconditionFailed
 
struct  UnsupportedMediaType
 
struct  InternalServerError
 
struct  NotImplemented
 
struct  ServiceUnavailable
 
class  Connection
 Represents a connection to an HTTP server. More...
 
class  Server
 

Enumerations

enum  Scheme { Scheme::HTTP }
 

Functions

std::ostream & operator<< (std::ostream &stream, const URL &url)
 
std::string encode (const std::string &s, const std::string &additional_chars="")
 Returns a percent-encoded string according to RFC 3986. More...
 
Try< std::string > decode (const std::string &s)
 Decode a string that is Base64-encoded with the standard Base64 alphabet. More...
 
Try< std::vector< Response > > decodeResponses (const std::string &s)
 Decode HTTP responses from the given string. More...
 
Future< Connectionconnect (const network::Address &address, Scheme scheme)
 
Future< Connectionconnect (const URL &url)
 
template<typename F >
Future< Nothingserve (const network::Socket &s, F &&f)
 
Request createRequest (const UPID &upid, const std::string &method, bool enableSSL=false, const Option< std::string > &path=None(), const Option< Headers > &headers=None(), const Option< std::string > &body=None(), const Option< std::string > &contentType=None())
 
Request createRequest (const URL &url, const std::string &method, const Option< Headers > &headers=None(), const Option< std::string > &body=None(), const Option< std::string > &contentType=None())
 
Future< Responserequest (const Request &request, bool streamedResponse=false)
 Asynchronously sends an HTTP request to the process and returns the HTTP response once the entire response is received. More...
 
Future< Responseget (const URL &url, const Option< Headers > &headers=None())
 
Future< Responseget (const UPID &upid, const Option< std::string > &path=None(), const Option< std::string > &query=None(), const Option< Headers > &headers=None(), const Option< std::string > &scheme=None())
 
Future< Responsepost (const URL &url, const Option< Headers > &headers=None(), const Option< std::string > &body=None(), const Option< std::string > &contentType=None())
 
Future< Responsepost (const UPID &upid, const Option< std::string > &path=None(), const Option< Headers > &headers=None(), const Option< std::string > &body=None(), const Option< std::string > &contentType=None(), const Option< std::string > &scheme=None())
 
Future< ResponserequestDelete (const URL &url, const Option< Headers > &headers=None())
 Asynchronously sends an HTTP DELETE request to the process with the given UPID and returns the HTTP response. More...
 
Future< ResponserequestDelete (const UPID &upid, const Option< std::string > &path=None(), const Option< Headers > &headers=None(), const Option< std::string > &scheme=None())
 Asynchronously sends an HTTP DELETE request to the process with the given UPID and returns the HTTP response. More...
 

Variables

hashmap< uint16_t, std::string > * statuses
 

Enumeration Type Documentation

enum process::http::Scheme
strong
Enumerator
HTTP 

Function Documentation

Future<Connection> process::http::connect ( const network::Address &  address,
Scheme  scheme 
)
Future<Connection> process::http::connect ( const URL &  url)
Request process::http::createRequest ( const UPID &  upid,
const std::string &  method,
bool  enableSSL = false,
const Option< std::string > &  path = None(),
const Option< Headers > &  headers = None(),
const Option< std::string > &  body = None(),
const Option< std::string > &  contentType = None() 
)
Request process::http::createRequest ( const URL &  url,
const std::string &  method,
const Option< Headers > &  headers = None(),
const Option< std::string > &  body = None(),
const Option< std::string > &  contentType = None() 
)
Try<std::string> process::http::decode ( const std::string &  s)
inline

Decode a string that is Base64-encoded with the standard Base64 alphabet.

See Also
RFC4648
Parameters
sThe string to decode.
Try<std::vector<Response> > process::http::decodeResponses ( const std::string &  s)

Decode HTTP responses from the given string.

Parameters
sthe given string.
std::string process::http::encode ( const std::string &  s,
const std::string &  additional_chars = "" 
)

Returns a percent-encoded string according to RFC 3986.

See Also
RFC3986
Parameters
sThe input string, must not arleady be percent-encoded.
additional_charsWhen specified, all characters in it are also percent-encoded.
Returns
The percent-encoded string of s.
Future<Response> process::http::get ( const URL &  url,
const Option< Headers > &  headers = None() 
)
Future<Response> process::http::get ( const UPID &  upid,
const Option< std::string > &  path = None(),
const Option< std::string > &  query = None(),
const Option< Headers > &  headers = None(),
const Option< std::string > &  scheme = None() 
)
std::ostream& process::http::operator<< ( std::ostream &  stream,
const URL &  url 
)
Future<Response> process::http::post ( const URL &  url,
const Option< Headers > &  headers = None(),
const Option< std::string > &  body = None(),
const Option< std::string > &  contentType = None() 
)
Future<Response> process::http::post ( const UPID &  upid,
const Option< std::string > &  path = None(),
const Option< Headers > &  headers = None(),
const Option< std::string > &  body = None(),
const Option< std::string > &  contentType = None(),
const Option< std::string > &  scheme = None() 
)
Future<Response> process::http::request ( const Request &  request,
bool  streamedResponse = false 
)

Asynchronously sends an HTTP request to the process and returns the HTTP response once the entire response is received.

Parameters
streamedResponseBeing true indicates the HTTP response will be 'PIPE' type, and caller must read the response body from the Pipe::Reader, otherwise, the HTTP response will be 'BODY' type.
Future<Response> process::http::requestDelete ( const URL &  url,
const Option< Headers > &  headers = None() 
)

Asynchronously sends an HTTP DELETE request to the process with the given UPID and returns the HTTP response.

Parameters
urlThe target url for the request.
headersOptional header for the request.
Returns
A future with the HTTP response.
Future<Response> process::http::requestDelete ( const UPID &  upid,
const Option< std::string > &  path = None(),
const Option< Headers > &  headers = None(),
const Option< std::string > &  scheme = None() 
)

Asynchronously sends an HTTP DELETE request to the process with the given UPID and returns the HTTP response.

Parameters
upidThe target process's assigned untyped PID.
pathThe optional path to be be deleted. If not send the request is send to the process directly.
headersOptional headers for the request.
schemeOptional scheme for the request.
Returns
A future with the HTTP response.
template<typename F >
Future<Nothing> process::http::serve ( const network::Socket &  s,
F &&  f 
)

Variable Documentation

hashmap<uint16_t, std::string>* process::http::statuses