iFun Engine API  1.0.0-b6053
Great Technology for Great Games
Classes | Typedefs | Enumerations | Functions
http_util.h File Reference
#include <boost/algorithm/string/predicate.hpp>
#include <funapi/types.h>
#include <funapi/utility/misc.h>
#include <map>

Go to the source code of this file.

Classes

struct  fun::http::Request
 Data structure to hold HTTP request. More...
 
struct  fun::http::Request2
 Data structure to hold HTTP request. More...
 
struct  fun::http::Response
 Data structure to hold HTTP response. More...
 
class  fun::http::Uri
 Class to parse an URI string. More...
 

Typedefs

typedef std::map< string, string, impl::util::CaseInsensitiveLess > fun::http::GetParameter
 Datastructure to hold paramester associated HTTP GET method.
 
typedef std::map< string, std::vector< string >, impl::util::CaseInsensitiveLess > fun::http::GetParameter2
 Datastructure to hold multiple value paramester associated HTTP GET method.
 
typedef std::multimap< string, string, impl::util::CaseInsensitiveLess > fun::http::Header
 Datastructure to hold http header fields.
 

Enumerations

enum  fun::http::Method {
  fun::http::kUnknownMethod = 0, fun::http::kGet, fun::http::kHead, fun::http::kPost,
  fun::http::kPut, fun::http::kDelete, fun::http::kTrace, fun::http::kOptions
}
 Enum type representing HTTP methods. More...
 
enum  fun::http::Protocol { fun::http::kHttp = 0, fun::http::kHttps }
 Enum type representing HTTP protocol type. More...
 
enum  fun::http::StatusCode {
  kContinue = 100, kSwitchingProtocols = 101, kOk = 200, kCreated = 201,
  kAccepted = 202, kNonAuthoritativeInformation = 203, kNoContent = 204, kResetContent = 205,
  kPartialContent = 206, kMultipleChoices = 300, kMovedPermanently = 301, kFound = 302,
  kSeeOther = 303, kNotModified = 304, kUseProxy = 305, kTemporaryRedirect = 307,
  kBadRequest = 400, kUnauthorized = 401, kPaymentRequired = 402, kForbidden = 403,
  kNotFound = 404, kMethodNotAllowed = 405, kNotAcceptable = 406, kProxyAuthenticationRequired = 407,
  kRequestTimeout = 408, kConflict = 409, kGone = 410, kLengthRequired = 411,
  kPreconditionFailed = 412, kRequestEntityTooLarge = 413, kRequestUriTooLong = 414, kUnsupportedMediaType = 415,
  kRequestRangeNotSatisfiable = 416, kExpectationFailed = 417, kTooManyRequests = 429, kInternalServerError = 500,
  kNotImplemented = 501, kBadGateway = 502, kServiceUnavailable = 503, kGatewayTimeout = 504,
  kHttpVersionNotSupported = 505
}
 Enum representing HTTP status code. More...
 
enum  fun::http::Version { fun::http::kUnknownVersion = 0, fun::http::kHttp0, fun::http::kHttp1 }
 Enum type representing HTTP version. More...
 

Functions

FUNAPI_DLL_VISIBILITY bool fun::http::Escape (const string &plain, string *out)
 Converts the given string to a URL encoded string. More...
 
FUNAPI_DLL_VISIBILITY const string & fun::http::GetMethodString (const Method &method)
 Converts an HTTP method to string. More...
 
FUNAPI_DLL_VISIBILITY const string & fun::http::GetStatusCodeString (int status_code)
 Converts an HTTP status code to string. More...
 
FUNAPI_DLL_VISIBILITY bool fun::http::Unescape (const string &url_encoded, string *out)
 Converts the given string to a URL decoded string. More...
 

Enumeration Type Documentation

◆ Method

For more information, http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

Enumerator
kUnknownMethod 

Invalid method.

kGet 

GET method.

kHead 

HEAD method.

kPost 

POST method.

kPut 

PUT method.

kDelete 

DELETE method.

kTrace 

TRACE method.

kOptions 

OPTIONS method.

◆ Protocol

Enumerator
kHttp 

HTTP.

kHttps 

HTTPS.

◆ StatusCode

◆ Version

Enumerator
kUnknownVersion 

Invalid version.

kHttp0 

HTTP/1.0.

kHttp1 

HTTP/1.1.

Function Documentation

◆ Escape()

FUNAPI_DLL_VISIBILITY bool fun::http::Escape ( const string plain,
string out 
)
Parameters
plaina plain string.
outa URL encoded string.
Returns
true if succeeded. false, otherwise.

◆ GetMethodString()

FUNAPI_DLL_VISIBILITY const string& fun::http::GetMethodString ( const Method method)
Parameters
methodHTTP method value.
Returns
string representation.

◆ GetStatusCodeString()

FUNAPI_DLL_VISIBILITY const string& fun::http::GetStatusCodeString ( int  status_code)
Parameters
status_codeHTTP status code value.
Returns
string representation.

◆ Unescape()

FUNAPI_DLL_VISIBILITY bool fun::http::Unescape ( const string url_encoded,
string out 
)
Parameters
url_encodeda URL encoded string.
outa URL decoded string.
Returns
true if succeeded. false, otherwise.