MapServer / mapcache

MapCache source code directory. Please submit pull requests to the 'main' branch.
https://mapserver.org/mapcache
Other
137 stars 96 forks source link

Incorrect HTTP code when empty_img is set in error tag in mapcache.xml #39

Open plagnetti opened 12 years ago

plagnetti commented 12 years ago

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) {

aeichner commented 9 years ago

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).