[MapProxy] Missing Content-Type header in WMS source
Oliver Tonnhofer
olt at omniscale.de
Mon Oct 29 01:39:15 PDT 2012
On 29.10.2012, at 09:28, A.Pirard.Papou wrote:
> On 2012-10-29 08:36, Oliver Tonnhofer wrote :
>> On 28.10.2012, at 15:12, Magnus E wrote:
>>
>>> Is there any way of telling Mapproxy explicitly that the incoming content is a png image? The only requests I make are for png images, so it probably wouldn't complicate matters if I let Mapproxy somehow assume that the source content is always a png image when the Content-Type header is missing.
>>>
>> There is no configuration option for that. But maybe MapProxy is checking too much in this case? I can change this check to only compare the Content-Type if it is present. Other parts of MapProxy already handle data that is not a valid image and MapProxy also checks for the HTTP status code (2xx).
>>
> Without a Content-Type, or rather a Mime-Type, the filename extension is normally used.
> With no extension either, Linux tests the magic (first) bytes of the file against a type match.
> See man file for an extended description.
> But, of course, the assumed type you requested is a perfect candidate.
> If you want a double check, you may test the magic bytes or have the file command do it.
That (magic-bytes) already happens when the image is opened by PIL.
> While waiting, Magnus might want to pipe the stream through a filter to add the C-T line.
> I met a problem following the links of StreamEdit below but there must be other filters.
> It probably takes less time building a patched mapproxy than to elaborate that filter ;-)
The changes are in the master branch. See http://mapproxy.org/download.html Nightly on how to upgrade.
Regards,
Oliver
--
Oliver Tonnhofer | Omniscale GmbH & Co KG | http://omniscale.de
http://mapproxy.org | https://github.com/olt | @oltonn
More information about the MapProxy
mailing list