[Mapserver-dev] RE: [Mapserver-users] additional parameters for WMSÂ layer
Mike V. Andreev
andreev at d902.iki.rssi.ru
Tue May 20 09:36:08 EDT 2003
Hello John,
thanks for your comments.
> Mike,
>
> I feel what you are asking is an implementation problem and not a mapserv development issue. I wouldn't like to see mapserv develop some WMS parameters that are not OGC compliant. Not everyone allows cookies on their browser for security reasons and tying mapserv into a particular type of implementation would be dangerous unless it was compliant to the OGC specification.
>
> I think that you could use hidden input types to pass the extra parameters backwards and forwards to your CGI scripts. However, I would be very surprised if the OGC specifications have not already catered for these extra parameters.
>
I'm not sure what do you mean here. If you mean that OGC specification
already include my parameters then you are wrong. This is not geographic
parameters. For example it is a list of monitoring object or a datetime
range. But OGC WMS specification allows me to use additional parameters
in request to my CGI script, and if I would request my script directly
there isn't a problem.
But request to my script must be formed by mapserver. And it contains:
1) string from layerObj.connection and 2) parameters formed by mapserver
(such as BBOX, SRS, etc). I can not define additional parameters in
mapserver's map file because they must be chosen by and user and change
from query to query.
By the other hand I can send additional parameters from form fields
(hidden or not) only to mapserver and they will have no an effect on
request mapserver send to my script. Or may be I miss something in docs
and there is some special mapserver option for it ? This would be a
solution.
> Just my initial thoughts on the idea.
>
> John
>
> > -----Original Message-----
> > From: Mike V. Andreev [mailto:andreev at d902.iki.rssi.ru]
> > Sent: Saturday, 17 May 2003 3:35
> > To: mapserver-dev at lists.gis.umn.edu
> > Cc: mapserver-users at lists.gis.umn.edu
> > Subject: [Mapserver-users] additional parameters for WMSÂ layer
> >
> >
> > Hello
> >
> > I have mapserever compiled with WMS client support and I use map file
> > with defined WMS layer. This layer is a http reference to my
> > perl script
> > on the same http server. This script understand OGC WMS parameters in
> > query string and can create maps whith information from some database.
> > But to create sensible map this script need additional information in
> > request. I wanted to use http cookies to store that parameters. But I
> > have a problem here. Then my client send request to http server with
> > mapserver URI request contain proper cookies but after that mapserver
> > need to make http request to perl script URI and of couse this request
> > contains no cookies.
> >
> > So I want to ask two question here:
> >
> > 1) Can somebody give me any hits to solve my problem with
> > existing soft?
> >
> > 2) I have an idea how to extend mapserver functionality so it
> > be able to
> > solve my problem. So I want to ask what do you people think about it.
> >
> > There is my proposal: each layer object could contain boolean
> > parameter
> > http_cookies_forwad (disabled by default). So if this featcher enabled
> > in layer with connectiontype equal to 'WMS' (and may be
> > 'WFS') than when
> > mapserver make http request to proper URL it sends additional http
> > headers: 1) Cookie - header with cookies client send to
> > mapserver and 2)
> > X-Forwarder-For - header with original client ip (as far as mapserver
> > can determine it).
> >
> >
> > Just to illustrate my idea I've made simple patch to maphttp.c. I used
> > today's (2003-05-16) nightly build. This patch contains only
> > functionality for sending proper http request. There is no
> > any stuff to
> > support new feature in layreObj but I think whole idea is clear.
> >
> >
> >
> >
> > 81a82,83
> > > #define HTTP_COOKIES_FORWARDING 1
> > >
> > 243a246,247
> > > char *tmp_env_read, *strBuf = NULL;
> > > struct curl_slist *slist=NULL;
> > 366a371,392
> > > /* If we need to forward http cookies to server */
> > > if( HTTP_COOKIES_FORWARDING && (tmp_env_read =
> > curl_getenv( "HTTP_COOKIE" ) ) != NULL ){
> > > /*add cookies to http_handle*/
> > > curl_easy_setopt(http_handle, CURLOPT_COOKIE,
> > tmp_env_read);
> > >
> > > /*add X-Forwarded-For header with original client ip */
> > > if( (tmp_env_read = curl_getenv(
> > "HTTP_X_FORWARDED_FOR" )) == NULL )
> > > if( (tmp_env_read = curl_getenv(
> > "HTTP_FORWARDED" ) ) == NULL )
> > > if( (tmp_env_read = curl_getenv(
> > "HTTP_CLIENT_IP" ) ) == NULL )
> > > tmp_env_read = curl_getenv( "REMOTE_ADDR" );
> > >
> > > if( tmp_env_read != NULL ){
> > > #define HTTP_HEADER_BUF_LENGTH 100
> > > strBuf = (char*)malloc( HTTP_HEADER_BUF_LENGTH );
> > > snprintf( strBuf, HTTP_HEADER_BUF_LENGTH,
> > "X-Forwarded-For: %s", tmp_env_read);
> > > #undef HTTP_HEADER_BUF_LENGTH
> > > slist = curl_slist_append( slist, strBuf);
> > > curl_easy_setopt(http_handle,
> > CURLOPT_HTTPHEADER, slist);
> > > }
> > > }
> > >
> > >
> > 554a581,583
> > > if( slist != NULL ){ curl_slist_free_all(slist); }
> > > if( strBuf != NULL ){ free( strBuf ); }
> > >
> > 556a586,587
> > > #undef HTTP_COOKIES_FORWARDING
> > >
> >
> >
> > --
> > ____________________________________________________________
> > | Mike Andreev, software engineer andreev at d902.iki.rssi.ru |
> > | SMIS Lab, Space Research Institute http://smis.iki.rssi.ru |
> > |____________________________________________________________|
> >
> >
> > _______________________________________________
> > Mapserver-users mailing list
> > Mapserver-users at lists.gis.umn.edu
> > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> >
--
____________________________________________________________
| Mike Andreev, software engineer andreev at d902.iki.rssi.ru |
| SMIS Lab, Space Research Institute http://smis.iki.rssi.ru |
|____________________________________________________________|
More information about the mapserver-dev
mailing list