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

Namespaces

 authentication
 
 authorization
 
 header
 
 internal
 
 path
 
 query
 
 streaming
 

Classes

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

Enumerations

enum  Scheme { Scheme::HTTP, Scheme::HTTP_UNIX }
 

Functions

bool isValidStatus (uint16_t code)
 
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, const Option< std::string > &peer_hostname)
 
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...
 

Enumeration Type Documentation

enum process::http::Scheme
strong
Enumerator
HTTP 
HTTP_UNIX 

Function Documentation

Future<Connection> process::http::connect ( const network::Address address,
Scheme  scheme,
const Option< std::string > &  peer_hostname 
)
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() 
)
bool process::http::isValidStatus ( uint16_t  code)
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 
)