|
| static size_t | write_memory_callback (void *contents, size_t size, size_t nmemb, void *userp) |
| | libcurl CURLOPT_WRITEFUNCTION callback appending response bytes into a MemoryStruct.
|
| static char * | ro_http_proxy_xyz_to_storagekey (struct storage_backend *store, int x, int y, int z, char *key) |
| | Format the upstream HTTP URL for tile (x, y, z).
|
| static int | ro_http_proxy_tile_retrieve (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z) |
| | Fetch a tile over HTTP from the upstream server or serve it from the single-tile cache.
|
| static int | ro_http_proxy_tile_read (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z, char *buf, size_t sz, int *compressed, char *log_msg) |
| | Retrieve a PNG tile from the upstream HTTP proxy into caller buffer buf.
|
| static struct stat_info | ro_http_proxy_tile_stat (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z) |
| | Retrieve metadata and Last-Modified timestamp for a tile from the HTTP proxy.
|
| static char * | ro_http_proxy_tile_storage_id (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z, char *string) |
| | Format the upstream "http://<baseurl>/<z>/<x>/<y>.png" URL as the tile storage ID.
|
| static int | ro_http_proxy_metatile_write (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z, const char *buf, int sz) |
| | Reject metatile write attempts on the read-only HTTP proxy backend.
|
| static int | ro_http_proxy_metatile_delete (struct storage_backend *store, const char *xmlconfig, int x, int y, int z) |
| | Reject metatile delete attempts on the read-only HTTP proxy backend.
|
| static int | ro_http_proxy_metatile_expire (struct storage_backend *store, const char *xmlconfig, int x, int y, int z) |
| | Reject metatile expiry attempts on the read-only HTTP proxy backend.
|
| static int | ro_http_proxy_close_storage (struct storage_backend *store) |
| | Free the base URL, cached tile buffer, CURL easy handle, and ro_http_proxy_ctx.
|
| struct storage_backend * | init_storage_ro_http_proxy (const char *connection_string) |
| | Allocate and initialize a read-only HTTP proxy storage_backend.
|
| struct storage_backend * init_storage_ro_http_proxy |
( |
const char * | connection_string | ) |
|
Allocate and initialize a read-only HTTP proxy storage_backend.
Strips the "ro_http_proxy://" prefix from connection_string to obtain the upstream base host/path, performs thread-safe one-time curl_global_init() under ro_http_proxy_mutex, configures a CURL easy handle with CURLOPT_NOSIGNAL, CURLOPT_FOLLOWLOCATION, CURLOPT_USERAGENT, and CURLOPT_FILETIME, and wires all backend operation function pointers. Returns NULL if compiled without HAVE_LIBCURL or if initialization fails.
- Parameters
-
| connection_string | Backend URI of the form "ro_http_proxy://<host[:port][/prefix]>". |
- Returns
- Newly allocated struct storage_backend pointer, or NULL on failure or if unsupported.
| int ro_http_proxy_tile_retrieve |
( |
struct storage_backend * | store, |
|
|
const char * | xmlconfig, |
|
|
const char * | options, |
|
|
int | x, |
|
|
int | y, |
|
|
int | z ) |
|
static |
Fetch a tile over HTTP from the upstream server or serve it from the single-tile cache.
Checks whether (xmlconfig, x, y, z) matches ctx->cache. On a cache hit, returns 1 immediately without performing network I/O. On a cache miss, issues an HTTP GET via curl_easy_perform() and updates ctx->cache:
- HTTP 200: Stores the downloaded PNG bytes, byte size, and Last-Modified timestamp (st_mtime).
- HTTP 404: Caches a negative lookup (st_stat.size = -1) so the subsequent tile_read() avoids a duplicate request.
- Other status codes or curl errors: Invalidates ctx->cache coordinates and returns -1.
- Parameters
-
| store | Initialized HTTP proxy storage_backend. |
| xmlconfig | Logical map style name used as part of the single-tile cache key. |
| options | Style parameterization options string (currently unused). |
| x | Tile X coordinate. |
| y | Tile Y coordinate. |
| z | Tile zoom level. |
- Returns
- 1 if the tile result (HTTP 200 or cached 404) is ready in ctx->cache, or -1 on network/HTTP error.