Opened 15 years ago

Closed 5 years ago

#2750 closed defect (wontfix)

WMS requests are not urlencoded

Reported by: geochuck Owned by: nowakpl
Priority: normal Milestone: closed_because_of_github_migration
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: wms urlencode
Cc: warmerdam

Description (last modified by warmerdam)

It appears that GDAL WMS requests are not urlencoded. This a space in the url ends up truncating the request. Example:

<ImageFormat>image/png; mode=24bit</ImageFormat>

Here is a test WMS file:

<GDAL_WMS>  	
  <Service name="WMS">
    <Version>1.1.1</Version>
    <ServerURL>http://giifmap.cnr.berkeley.edu/cgi-bin/naip.wms?</ServerUrl>
    <SRS>EPSG:4326</SRS>
    <ImageFormat>image/png; mode=24bit</ImageFormat>
    <Layers>naip2005</Layers>
  </Service> 	
	<DataWindow>
		<UpperLeftX>-124.45</UpperLeftX> 
		<UpperLeftY>42.0421</UpperLeftY>
		<LowerRightX>-113.222</LowerRightX>
		<LowerRightY>32.2006</LowerRightY>
		<SizeX>1247554</SizeX>
		<SizeY>1093499</SizeY>
	</DataWindow> 	
	<BandsCount>3</BandsCount>
	<ClampRequests>false</ClampRequests> 
</GDAL_WMS> 	

Attachments (2)

gdal-r16174-t2750.patch (4.7 KB ) - added by nowakpl 15 years ago.
gdal-r16174-t2750-2.patch (4.8 KB ) - added by nowakpl 15 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by warmerdam, 15 years ago

Cc: warmerdam added
Description: modified (diff)
Keywords: wms urlencode added
Owner: changed from warmerdam to nowakpl

Adam,

Can you review, and prepare an appropriate patch?

by nowakpl, 15 years ago

Attachment: gdal-r16174-t2750.patch added

by nowakpl, 15 years ago

Attachment: gdal-r16174-t2750-2.patch added

comment:2 by nowakpl, 15 years ago

Ignore gdal-r16174-t2750.patch, has problems with chars >= 128

comment:3 by Even Rouault, 15 years ago

gdal-r16174-t2750-2.patch looks good, but I think we need to add some magic in UrlEncode() for backward compatibility, so that it still works for people who have already workaround the problem by urlencoding at hand.

For example, in "image%2Fpng%3B+mode%3D24bit" we see '%XY' patterns (where X and Y are hex characters), so we could suppose that it is already url encoded and just return the unmodified string.

comment:4 by Jukka Rahkonen, 10 years ago

Motion: While waiting for a real fix, add a line about the possible need to use url-encoding at least for problematic characters inside GDAL WMS file. Instead of for example "image/png; mode=8bit" write completely url-encoded <ImageFormat>image%2Fpng%3B%20mode%3D8bit</ImageFormat> or simplified <ImageFormat>image/png%3B%20mode=8bit</ImageFormat>

Working example for Geoserver demo layer topp:states

<GDAL_WMS>  	
  <Service name="WMS">
    <Version>1.1.1</Version>
    <ServerURL>http://localhost:8080/geoserver/wms?</ServerURL>
    <SRS>EPSG:4326</SRS>
    <ImageFormat>image/png%3B%20mode=8bit</ImageFormat>
    <Layers>topp:states</Layers>
  </Service> 	
	<DataWindow>
		<UpperLeftX>-124.45</UpperLeftX> 
		<UpperLeftY>42.0421</UpperLeftY>
		<LowerRightX>-113.222</LowerRightX>
		<LowerRightY>32.2006</LowerRightY>
		<SizeX>1247554</SizeX>
		<SizeY>1093499</SizeY>
	</DataWindow> 	
	<BandsCount>3</BandsCount>
	<ClampRequests>false</ClampRequests> 
</GDAL_WMS> 	

comment:5 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.