Yes, I’d like to see the map layers and capabilities available from my MapServer MAP file, and no I don’t want to download mapserv.exe..
Messing with Headers
I had the same problem with both Firefox and Internet Explorer 7 each time I issues a request such as:
The browser tried to download mapserv.exe. The “exe” did actually contain the GetCapabilities XML, but it is very annoying to have to manually open it in another program each time.
In FireFox I went about associating an application with the MIME type application/vnd.ogc.wms_xml, following the steps outlined here. After a restart of FireFox nothing had changed.
I used FireBug to check that the request was returning the correct MIME type. As shown in the image below the server was correctly returning the correct Content-Type.
I then checked the request parameters sent from my browser to the server. These included:
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-US,en;q=0.7... Accept-Encoding gzip,deflate
I then thought the reason for trying to download the content was due to my browser not “accepting” the application/vnd.ogc.wms_xml type. I used another FireFox Add-In to modify my request headers to accept the content type (and “chunked” encoding just for good measure..).
The headers sent with my request now looked as follows:
Accept application/vnd.ogc.wms_xml,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-US,en;q=0.7,chrome://global/locale/intl.properties;q=0.3 Accept-Encoding chunked,gzip,deflate
A Hackish Solution
All good “fun” but I was still met with the same dialog box to download the content. FireBug still reported the response data as “The resource from this URL is not text.”
This post hints that the content type defined in the WMS specs was a mistake, and that for the new WMS specifications the content type will be set to text/html by default. It also suggested that adding a &EXECPTIONS=text/html parameter to the request string could override the content type, but this (I believe) is only where an exceptions actually occur s on the server.
I stumbled across a solution by accident. While entering a request string I put an incorrect version number in the VERSION parameter:
The response came back in an
text/xml format that was displayed in the browser! Whilst not very satisfactory, it was nicer than having to manually open up fake .exe files. If anyone can shed any light on why this is happening please let me know.