Documentation of SFML 1.6

Warning: this page refers to an old version of SFML. Click here to switch to the latest version.
sf::Http::Response Class Reference

This class wraps an HTTP response, which is basically : More...

#include <Http.hpp>

Public Types

enum  Status {
  Ok = 200,
  Created = 201,
  Accepted = 202,
  NoContent = 204,
  MultipleChoices = 300,
  MovedPermanently = 301,
  MovedTemporarily = 302,
  NotModified = 304,
  BadRequest = 400,
  Unauthorized = 401,
  Forbidden = 403,
  NotFound = 404,
  InternalServerError = 500,
  NotImplemented = 501,
  BadGateway = 502,
  ServiceNotAvailable = 503,
  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 :

  • a header with a status code and a set of field/value pairs
  • a body (the content of the requested resource)

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 

Sent when the server didn't send any data in return.

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.

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, ...)

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.

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
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
unsigned int sf::Http::Response::GetMajorHttpVersion ( ) const

Get the major HTTP version number of the response.

Returns
Major version number
unsigned int sf::Http::Response::GetMinorHttpVersion ( ) const

Get the major HTTP version number of the response.

Returns
Major version number
Status sf::Http::Response::GetStatus ( ) const

Get the header's status code.

Returns
Header's status code

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