Public Types | Public Member Functions | Friends | List of all members
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. More...
 
const std::string & GetField (const std::string &Field) const
 Get the value of a field. More...
 
Status GetStatus () const
 Get the header's status code. More...
 
unsigned int GetMajorHttpVersion () const
 Get the major HTTP version number of the response. More...
 
unsigned int GetMinorHttpVersion () const
 Get the major HTTP version number of the response. More...
 
const std::string & GetBody () const
 Get the body of the response. More...
 

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

◆ Status

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

◆ Response()

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

Default constructor.

Definition at line 169 of file Http.cpp.

Member Function Documentation

◆ GetBody()

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 230 of file Http.cpp.

◆ GetField()

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 181 of file Http.cpp.

◆ GetMajorHttpVersion()

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

Get the major HTTP version number of the response.

Returns
Major version number

Definition at line 208 of file Http.cpp.

◆ GetMinorHttpVersion()

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

Get the major HTTP version number of the response.

Returns
Major version number

Definition at line 217 of file Http.cpp.

◆ GetStatus()

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

Get the header's status code.

Returns
Header's status code

Definition at line 199 of file Http.cpp.


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