MapServer / MapServer-import

3 stars 2 forks source link

wfslayer get request : check if trailing ? or & is missing #1082

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: assefa Date: 2004/11/22 - 22:10

Whem generating the url for a wfslayer get request (msBuildWFSLayerGetURL), 
there is no check to see if a trailing ? or & for the connection parameter is 
there (a la msOWSGetOnlineResource).

Ex : if  CONNECTION is set to "http://map.ns.ec.gc.ca/envdat/map.aspx" and
metadata "wfs_request_method" "GET" , it will pose a problem.  (Need the ? at 
the end)
tbonfort commented 12 years ago

Author: dmorissette Date: 2004/11/22 - 22:39

I believe we have code in mapwmslayer.c to add the trailing "&" or "?" that
could easily be extracted to a function and shared between the WMS and WFS code.
tbonfort commented 12 years ago

Author: tylermitchell@shaw.ca Date: 2004/11/24 - 06:10

I'm setting up WFS server and think I'm hitting a related bug, using 
4.4b3/current CVS. 

When trying to get capabilities of my WFS server, I'm getting: 
---- 
XML parsing error 

fatal parsing error: letter is expected in line 19, column 126 (points to the 
& at the end) 
  <OnlineResource>http://spatialguru.com/cgi-bin/mapserv440b3?map=/srv/www/vhosts/spatialguru/maps/apps/global/globalwfs.map&</OnlineResource> 
---- 
My online resource in the map file is set to: 
<snip>...?map=/srv/www/vhosts/spatialguru/maps/apps/global/globalwfs.map" 

I've tried adding & or &amp or &amp; with no change. 
Is this related? 
tbonfort commented 12 years ago

Author: dmorissette Date: 2004/11/24 - 16:49

> I've tried adding & or &amp or &amp; with no change. 

Are you sure that "&amp;" doesn't fix the issue? I can't see any other reason
for the XML parser to complain. Can you please try with "&amp;" again?
tbonfort commented 12 years ago

Author: tylermitchell@shaw.ca Date: 2004/11/25 - 05:38

Yep, same kind of response. Note that it appears to ignore the &amp; and tries 
to replace it with &. 

XML parsing error 

fatal parsing error: letter is expected in line 19, column 131 
<snip>...mapserv440b3?map=/srv/www/<snip>/globalwfs.map&amp;&</OnlineResource> 

The error points to col 131, the "<" symbol. 
tbonfort commented 12 years ago

Author: tylermitchell@shaw.ca Date: 2004/11/25 - 05:45

Before you look further let me make sure I've got the version right here, I 
have some doubts... 
tbonfort commented 12 years ago

Author: tylermitchell@shaw.ca Date: 2004/11/25 - 06:03

Still confirmed with fresh CVS sources.  Problem with my parser? 
tbonfort commented 12 years ago

Author: dmorissette Date: 2004/11/25 - 06:18

not a parder problem: there is indeed a problem with the trailing '&' in the XML
output that you quoted. What I don't understand is that the behavior you
describe would be complete ly the opposite of what Tom initially reported.

In Tom's case he was complaining that MapServer was *not* appending a trailing
"&", and in your case you do get one but it's just not encoded properly.

I think I know how to fix this, but I'm wondering if you are both talking about
the same thing. Um... I think I understand now:

- I think Tom may have been talking about the use of wfs_onlineresource in WFS
client layers
- I think you are referring to problems with WFS server

If that's the case then I know how both can be fixed, and I think we need this
fixed in 4.4
tbonfort commented 12 years ago

Author: dmorissette Date: 2004/11/25 - 06:24

Tyler, I have verified that the WFS server calls msOWSGetOnlineResource(), so it
does the right thing already with respect to appending the trailing "&" and
encoding the string. Can you please attach a mapfile that reproduces your problem?
tbonfort commented 12 years ago

Author: dmorissette Date: 2004/11/25 - 07:28

Okay, it turns out that there were two different problems and they are both fixed:

1- The original problem that was reported in this bug was that we didn't check
fr the presence of "?" or "&" at the end of the layer->connection when building
the WFS client request. This is fixed now by calling the new
msOWSTerminateOnlineResource() function (code extracted from
msOWSGetOnlineResource().

2- Tyler's problem, was in WFS server mode. If wfs_service_onlineresource was
not specified then we were using the value of wfs_onlineresource unencoded. I
have fixed the server code to use the encoded value.
tbonfort commented 12 years ago

Author: assefa Date: 2004/11/26 - 17:20

Just to note that I have tested the initial bug (trailing ? or & missing) for 
wfs client layers and all seems to work well.
tbonfort commented 12 years ago

Author: dmorissette Date: 2004/11/26 - 17:34

Thanks.