WMS images returned as Content-type: text/plain

Andrew Larcombe andrew at ANDREWLARCOMBE.CO.UK
Fri Oct 20 19:06:54 EDT 2006


I've come across a wierd problem, namely my mapserver powered WMS is 
returning Content-type: text/plain before the 'proper' Content-type for 
the image. I'm pulling my hair out and it's getting late, so I'm asking 
in the hope that someone else has been here and done this already.

Using wget to get a fairly straightforward WMS request:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 >$ wget  -S 
"http://myserver/cgi-bin/srtm.wms?LAYERS=srtm&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=-1.757812,50.656426,-1.40625,50.878777&WIDTH=256&HEIGHT=256"
--23:55:17-- 
http://myserver/cgi-bin/srtm.wms?LAYERS=srtm&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=-1.757812,50.656426,-1.40625,50.878777&WIDTH=256&HEIGHT=256
            => 
`srtm.wms?LAYERS=srtm&FORMAT=image%2Fjpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=-1.757812,50.656426,-1.40625,50.878777&WIDTH=256&HEIGHT=256.6'
Resolving myserver... 111.222.333.444
Connecting to myserver|111.222.333.444|:80... connected.
HTTP request sent, awaiting response...
   HTTP/1.1 200 OK
   Date: Fri, 20 Oct 2006 22:54:32 GMT
   Server: Apache/1.3.33 (Unix) PHP/5.0.3
   Connection: close
   Content-Type: text/plain
Length: unspecified [text/plain]

     [  <=>                                ] 1,039          1.96K/s

23:55:18 (1.96 KB/s) - 
`srtm.wms?LAYERS=srtm&FORMAT=image%2Fjpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=-1.757812,50.656426,-1.40625,50.878777&WIDTH=256&HEIGHT=256.6' 
saved [1039]
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

The Content-Type is returned as text/plain for some reason. Cat'ing the 
file reveals that there's another Content-type:, followed by the line 
feed, followed by the actual jpeg image. By removing the first two lines 
in vi and saving the file, I'm able to view the jpeg just fine.

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 >$ cat 
srtm.wms\?LAYERS\=srtm\&FORMAT\=image%2Fjpeg\&SERVICE\=WMS\&VERSION\=1.1.1\&REQUEST\=GetMap\&STYLES\=\&EXCEPTIONS\=application%2Fvnd.ogc.se_inimage\&SRS\=EPSG\:4326\&BBOX\=-1.757812\,50.656426\,-1.40625\,50.878777\&WIDTH\=256\&HEIGHT\=256.6
Content-type: image/jpeg

<load of binary content here, stripped for email>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

I'm sure the answer is probably straightforward, but why/how is 
mapserver adding the spurious Content-type header and screwing these 
requests up?

Thanks,

Andrew

-- 
Andrew Larcombe
Freelance Geospatial, Database & Web Programming

web: http://www.andrewlarcombe.co.uk
email: andrew at andrewlarcombe.co.uk
icq: 306690163



More information about the mapserver-users mailing list