mapcache
mapcache copied to clipboard
Incorrect HTTP code when empty_img is set in error tag in mapcache.xml
When i set empty_img in mapcache configuration file and when tile is not present in cache, mapcache return an error on request. Normaly, I think the normal issue is send empty image and HTTP 200 OK ? If this is the normal way core.c must be patched to set code 200 before return tile. Here is my patch to perform the correct return request for me:
--- core.c 2012-08-02 13:19:00.133930898 +0200
+++ /home/pla/Territor/SVN/trunk/mapcache-src/lib/./core.c 2012-06-18 16:51:46.272659544 +0200
@@ -553,6 +553,7 @@
response->data->avail = response->data->size;
} else if(ctx->config && ctx->config->reporting == MAPCACHE_REPORT_EMPTY_IMG) {
response->data = ctx->config->empty_image;
- response->code = 200;
apr_table_set(response->headers, "Content-Type", ctx->config->default_image_format->mime_type);
apr_table_set(response->headers, "X-Mapcache-Error", msg);
} else if(ctx->config && ctx->config->reporting == MAPCACHE_REPORT_ERROR_IMG) {
I agree and assume that the same applies to in-image error reporting. Cache headers should be set in those cases to enforce a client not to cache the result (at least for transient errors).