Opened 21 years ago

Last modified 17 years ago

#456 new defect

WMS sometimes produces HTML instead of XML exception

Reported by: dmorissette Owned by: mapserverbugs
Priority: high Milestone: FUTURE
Component: WMS Server Version: 4.1
Severity: normal Keywords:
Cc: bfraser@…

Description

On 2003-10-08, Brent Fraser wrote to mapserver-users:
> 
> Some background:
> 
> In fact Mapserver failed to create an image because the IMAGEPATH in the WEB
> object was not set to an existing directory.  This does not generate a error
> during map file parsing.  That's ok since I was using Mapserver as a WMS
> server, it doesn't need a temp dir for the images as it sends them as a data
> stream to the web server and on to the browser (or so I thought).  However,
> msWMSGetMap attempts to do a msSaveImage, which does a msSaveImageGDAL (I
> had switched my outputformat from GD to the GDAL driver), which tries to
> write a temp file to IMAGEPATH.  That failed, and displayed an error showing
> all the tiles it couldn't find in the tile index.
> 
> So the rule is:  Make sure IMAGEPATH is set to a valid directory if you are
> using GDAL drivers for output.
> 
...
> Some suggestions for Mapserver (and associated utilities):
> 
...
> 
> 2. Report Mapfile errors as XML.  We should be able to check if "Request="
> is a CGI parameter.  Or use some other non-mapfile mechanism to determine if
> the protocol is OGC.
> 


Brent reports that in the above situation MapServer returns the error messages
in HTML instead of in the requested WMS Exception format (XML or INIMAGE).

We should at a minimum fix MapServer so that in the above case (IMAGEPATH
missing or invalid with GDAL output) then the XML or INIMAGE error is produced
properly.

Change History (5)

comment:1 by bfraser@…, 21 years ago

Actually Mapserver may be sending the right "content-type" already.  I use some 
lean-and-mean ASP as a shim between Mapserver.  It may not be passing the 
content-type thru properly.

My original suggestion was to report <B>Mapfile</B> errors using the OGC 
interface.  Unlike other errors (map rendering, etc) these errors are formatted 
as text (or HTML?), not the XML which most OGC clients would expect/demand.

Brent

comment:2 by assefa, 19 years ago

I have commented out my IMAGEPATH and set the outputformat to be image/tiff 
(that should go through GDAL) and did a wms get map request with no problem. 
Is this still an issue ?

comment:3 by assefa, 19 years ago

I can not reproduce exactly the error mesaages that Brent described, but  
looking into the code, if msSaveImageGDAL fails for some reason, It sets the 
error stack properly and returns. The problem I see is that mapserver/wms is 
structured like this :

   msIO_printf("Content-type: %s%c%c",
              MS_IMAGE_MIME_TYPE(map->outputformat), 10,10);
  if (msSaveImage(map, img, NULL) != MS_SUCCESS)
     return msWMSException(map, nVersion, NULL);

 So the content type is sent before knowing if the  msSaveImage was successful 
(and then the wms exception is sent). 

 Unless we restucure things so that each driver is responsible of sending the 
content-type, there is not much which can be done.  

 I guess a note in the documentation should be added on this for the 4.4 
release but altering the way things are structrured should be revisited later. 
Whay do you think ?
 


comment:4 by dmorissette, 19 years ago

Milestone: 4.6 release
It might not be a bad idea to rewrite msSaveImage() to receive an optional
argument that would tell it whether it should emit the HTTP headers. However
this seems like a relatively minor issue and I would rather not make this kind
of change at this late time before the release.

Let's schedule this for 4.6.

comment:5 by assefa, 17 years ago

Milestone: 5.0 releaseFUTURE
Note: See TracTickets for help on using tickets.