21 #ifndef G_HTTP_CLIENT_PROTOCOL__H
22 #define G_HTTP_CLIENT_PROTOCOL__H
34 class HttpClientProtocol ;
46 G_EXCEPTION( Auth ,
"http client protocol" ) ;
47 G_EXCEPTION( Fail ,
"http client protocol error" ) ;
48 G_EXCEPTION( Retry ,
"http client protocol" ) ;
56 virtual void onHttpBody(
const std::string & outer_content_type ,
const std::string & content_type ,
57 const char * body ,
size_t body_size ) = 0 ;
73 void apply(
const char * ,
size_t ) ;
79 std::string
get = std::string() ,
bool =
false ) ;
88 static std::string hash(
const std::string & ) ;
90 void sendGetWithAuth() ;
void apply(const char *, size_t)
To be called on receipt of data.
HttpClientProtocol(Callback &, const G::Url &url)
Constructor.
A simple parser for URLs.
A callback interface for GNet::HttpClientProtocol to send data and deliver content.
A protocol driver for an http client.
A parser for HTTP responses received from a remote server.
void start()
Assembles a GET request (based on the constructor url) and asks the callback interface to send it...
virtual void onHttpBody(const std::string &outer_content_type, const std::string &content_type, const char *body, size_t body_size)=0
Called on receipt of a complete response, or a multipart part.
static std::string authorisation(const GNet::HttpClientParser &, const G::Url &, std::string get=std::string(), bool=false)
Returns an "Authorization" header for adding to a "GET" request.
virtual ~Callback()
Destructor.
virtual void sendHttpRequest(const std::string &)=0
Called by the HttpClientProtocol when it needs to send a http request string.