parse cache-control and last-modified headers
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
#ifndef MBGL_PLATFORM_PLATFORM
|
||||
#define MBGL_PLATFORM_PLATFORM
|
||||
|
||||
#include <mbgl/platform/response.hpp>
|
||||
|
||||
#include <mbgl/util/uv.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
namespace mbgl {
|
||||
@@ -12,14 +13,6 @@ namespace platform {
|
||||
|
||||
class Request;
|
||||
|
||||
struct Response {
|
||||
Response(std::function<void(Response *)> callback) : callback(callback) {}
|
||||
int16_t code = -1;
|
||||
std::string body;
|
||||
std::string error_message;
|
||||
std::function<void(Response *)> callback;
|
||||
};
|
||||
|
||||
// Makes an HTTP request of a URL, preferrably on a background thread, and calls a function with the
|
||||
// results in the original thread (which runs the libuv loop).
|
||||
// If the loop pointer is NULL, the callback function will be called on an arbitrary thread.
|
||||
|
||||
29
include/mbgl/platform/response.hpp
Normal file
29
include/mbgl/platform/response.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef MBGL_PLATFORM_RESPONSE
|
||||
#define MBGL_PLATFORM_RESPONSE
|
||||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <ctime>
|
||||
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace platform {
|
||||
|
||||
struct Response : private util::noncopyable {
|
||||
Response(std::function<void(Response *)> callback) : callback(callback) {}
|
||||
int16_t code = -1;
|
||||
std::string body;
|
||||
std::string error_message;
|
||||
std::time_t modified;
|
||||
std::time_t expires;
|
||||
std::function<void(Response *)> callback;
|
||||
|
||||
void setCacheControl(const char *value);
|
||||
void setLastModified(const char *value);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user