[mapserver-dev] Can msIO_stripStdoutBufferContentHeaders()
return headers and be available through MapScript?
Annabell Schelton Lima
aschelton at uci.cu
Mon Jun 13 12:32:35 EDT 2011
Hi list, i got a problem with a WFS encoding, although i defined in the section metadata "wfs encoding" "utf 8", i have problem with some characters like á and í, somebody can help me??
Best regards,Ana.
----- Mensaje original -----
De: "Stephan Meißl" <stephan at meissl.name>
Para: "Jean-François Gigand" <jean-francois at gigand.fr>
CC: "mapserver-dev" <mapserver-dev at lists.osgeo.org>
Enviados: Lunes, 13 de Junio 2011 11:59:09 GMT -04:00 Georgetown
Asunto: Re: [mapserver-dev] Can msIO_stripStdoutBufferContentHeaders() return headers and be available through MapScript?
Jean-François,
in 6.0 the exact function you propose was added (see [1]). It doesn't
return the headers though. I haven't tested the function in PHP
MapScript but it works with Python.
cu
Stephan
[1] http://mapserver.org/mapscript/mapscript.html#mapscript-functions
On Mon, 2011-06-13 at 15:27 +0200, Jean-François Gigand wrote:
> Hi,
>
> I use PHP MapScript and handle WxS requests through the "MapScript
> Wrappers for WxS Services", which work fine.
>
> Since 6.0 I also use OGR output (ZIP of CSV/Shapefiles), which also
> works fine (much thanks, 6.0 kicks ass!).
>
> Through {,Fast}Cgi, everything is fine.
> But, through (PHP) MapScript, when the WxS request outputs a
> "Content-Disposition" header, the ms_ioStripStdoutBufferContentType()
> function is of no use, as the Content-Type header is not the first
> one, and no MapScript method would extract the "Content-Disposition"
> header anyway.
>
> To my guess, the perfect solution would be a
> msIO_stripStdoutBufferContentHeaders() function which:
> - would return the headers, not just strip them off, for example
> returning a <char **>
> - would be available through MapScript
>
> If you confirm the need for this solution, I can develop it and send you a patch
> (just advise me about the function name and prototype (<char***> param
> or <char**> return?).
>
> So far, I have done this through PHP, see the function below:
>
> /**
> * Strip off Content-* headers from buffer and set them on response object
> *
> * @param $buffer string Ref to buffer string, which may
> include Content-* headers
> * @param $reponse Response Framework-dependant response object to
> add the headers to
> */
> function extractContentHeaders(&$buffer, Response $response)
> {
> $length = -1;
> $regex = "/^(Content-[a-zA-Z-]+): ([a-zA-Z0-9.\/=?!_; -]+)\n/";
> while (strlen($buffer) != $length) {
> $length = strlen($buffer);
> $cb = function($m) use ($response) {
> $response->headers->set($m[1], $m[2]);
> return '';
> };
> $buffer = preg_replace_callback($regex,$cb, $buffer);
> }
> }
>
>
> Best regards,
>
> JF Gigand
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
_______________________________________________
mapserver-dev mailing list
mapserver-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-dev
More information about the mapserver-dev
mailing list