extended request and get to optionally retrieve last-modified header, fix for potentially wrong content-length extraction

This commit is contained in:
john30
2018-04-04 09:57:38 +02:00
parent 0c8563be16
commit a77b740720
2 changed files with 56 additions and 7 deletions
+4 -2
View File
@@ -100,9 +100,10 @@ class HttpClient {
* @param uri the URI string.
* @param body the optional body to send.
* @param response the response body from the server (or the HTTP header on error).
* @param time optional pointer to a @a time_t value for storing the modification time of the file, or NULL.
* @return true on success, false on error.
*/
bool get(const string& uri, const string& body, string& response);
bool get(const string& uri, const string& body, string& response, time_t* time = NULL);
/**
* Execute a POST request.
@@ -118,9 +119,10 @@ class HttpClient {
* @param uri the URI string.
* @param body the optional body to send.
* @param response the response body from the server (or the HTTP header on error).
* @param time optional pointer to a @a time_t value for storing the modification time of the file, or NULL.
* @return true on success, false on error.
*/
bool request(const string& method, const string& uri, const string& body, string& response);
bool request(const string& method, const string& uri, const string& body, string& response, time_t* time = NULL);
private:
/**