sf::Http::Response Class Reference

This class wraps an HTTP response, which is basically :

More...

#include <Http.hpp>

List of all members.

Public Types

enum  Status {
  Ok = 200,
  Created = 201,
  Accepted = 202,
  NoContent = 204,
  ResetContent = 205,
  PartialContent = 206,
  MultipleChoices = 300,
  MovedPermanently = 301,
  MovedTemporarily = 302,
  NotModified = 304,
  BadRequest = 400,
  Unauthorized = 401,
  Forbidden = 403,
  NotFound = 404,
  RangeNotSatisfiable = 407,
  InternalServerError = 500,
  NotImplemented = 501,
  BadGateway = 502,
  ServiceNotAvailable = 503,
  GatewayTimeout = 504,
  VersionNotSupported = 505,
  InvalidResponse = 1000,
  ConnectionFailed = 1001
}
 

Enumerate all the valid status codes returned in a HTTP response.

More...

Public Member Functions

 Response ()
 Default constructor.
const std::string & GetField (const std::string &field) const
 Get the value of a field.
Status GetStatus () const
 Get the header's status code.
unsigned int GetMajorHttpVersion () const
 Get the major HTTP version number of the response.
unsigned int GetMinorHttpVersion () const
 Get the major HTTP version number of the response.
const std::string & GetBody () const
 Get the body of the response.

Friends

class Http

Detailed Description

This class wraps an HTTP response, which is basically :

Definition at line 168 of file Http.hpp.


Member Enumeration Documentation

Enumerate all the valid status codes returned in a HTTP response.

Enumerator:
Ok 

Most common code returned when operation was successful.

Created 

The resource has successfully been created.

Accepted 

The request has been accepted, but will be processed later by the server.

NoContent 

The server didn't send any data in return.

ResetContent 

The server informs the client that it should clear the view (form) that caused the request to be sent.

PartialContent 

The server has sent a part of the resource, as a response to a partial GET request.

MultipleChoices 

The requested page can be accessed from several locations.

MovedPermanently 

The requested page has permanently moved to a new location.

MovedTemporarily 

The requested page has temporarily moved to a new location.

NotModified 

For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed.

BadRequest 

The server couldn't understand the request (syntax error).

Unauthorized 

The requested page needs an authentification to be accessed.

Forbidden 

The requested page cannot be accessed at all, even with authentification.

NotFound 

The requested page doesn't exist.

RangeNotSatisfiable 

The server can't satisfy the partial GET request (with a "Range" header field).

InternalServerError 

The server encountered an unexpected error.

NotImplemented 

The server doesn't implement a requested feature.

BadGateway 

The gateway server has received an error from the source server.

ServiceNotAvailable 

The server is temporarily unavailable (overloaded, in maintenance, ...).

GatewayTimeout 

The gateway server couldn't receive a response from the source server.

VersionNotSupported 

The server doesn't support the requested HTTP version.

InvalidResponse 

Response is not a valid HTTP one.

ConnectionFailed 

Connection with server failed.

Definition at line 176 of file Http.hpp.


Constructor & Destructor Documentation

sf::Http::Response::Response (  ) 

Default constructor.

Definition at line 168 of file Http.cpp.


Member Function Documentation

const std::string & sf::Http::Response::GetBody (  )  const

Get the body of the response.

The body can contain :

  • the requested page (for GET requests)
  • a response from the server (for POST requests)
  • nothing (for HEAD requests)
  • an error message (in case of an error)
Returns:
The response body

The body can contain :

  • the requested page (for GET requests)
  • a response from the server (for POST requests)
  • nothing (for HEAD requests)
  • an error message (in case of an error)

Definition at line 229 of file Http.cpp.

const std::string & sf::Http::Response::GetField ( const std::string &  field  )  const

Get the value of a field.

Parameters:
field : Name of the field to get (case-insensitive)
Returns:
Value of the field, or empty string if not found

Definition at line 180 of file Http.cpp.

unsigned int sf::Http::Response::GetMajorHttpVersion (  )  const

Get the major HTTP version number of the response.

Returns:
Major version number

Definition at line 207 of file Http.cpp.

unsigned int sf::Http::Response::GetMinorHttpVersion (  )  const

Get the major HTTP version number of the response.

Returns:
Major version number

Definition at line 216 of file Http.cpp.

Http::Response::Status sf::Http::Response::GetStatus (  )  const

Get the header's status code.

Returns:
Header's status code

Definition at line 198 of file Http.cpp.


The documentation for this class was generated from the following files: