[mapserver-commits] [MapServer/MapServer] a18b16: Add HTTP status code for WMS requests, if MS_WMS_E...

Even Rouault noreply at github.com
Mon Dec 9 06:29:17 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/MapServer/MapServer
  Commit: a18b16969833fb63a36673757d2d0db7a0a69a4f
      https://github.com/MapServer/MapServer/commit/a18b16969833fb63a36673757d2d0db7a0a69a4f
  Author: Even Rouault <even.rouault at spatialys.com>
  Date:   2024-12-09 (Mon, 09 Dec 2024)

  Changed paths:
    M CMakeLists.txt
    A msautotest/wxs/expected/wms_invalid_request_with_400_status.txt
    A msautotest/wxs/expected/wms_invalid_request_with_500_status.txt
    A msautotest/wxs/expected/wms_invalid_request_without_500_status.txt
    M msautotest/wxs/wms_simple.map
    M src/maperror.c
    M src/maperror.h
    M src/mapfile.c
    M src/mapservutil.c
    M src/mapwms.cpp

  Log Message:
  -----------
  Add HTTP status code for WMS requests, if MS_WMS_ERROR_STATUS_CODE config option/env variable are set to ON (#7191)

Currently when one issues an HTTP request that ends up in error,
MapServer doesn't emit a HTTP Status header response. Hence the
webserver will default to generate a 200 OK one.

This is an historical behavior used by other WMS server implementations
(GeoServer, Degree) due to the WMS specification being unclear on what
do do. Given that WMS is in a retirement phase, it would be risky to
change that behavior by default.

That said there are WMS clients that would enjoy having a proper HTTP
400 or 500 status code. Hence if the MS_WMS_ERROR_STATUS_CODE
environment variable / config option is set to ON (typically in the ENV
section of the mapserver configuration file), MapServer will emit those
status codes.

This relies on code to call the msSetErrorWithStatus() new function. A
pass has been done in mapwms.cpp to call it. And a more moderate one in
a few places of mapfile.c and mapservutil.c related to generic mapfile
handling.



To unsubscribe from these emails, change your notification settings at https://github.com/MapServer/MapServer/settings/notifications


More information about the MapServer-commits mailing list