Feature request #1733

When a / is on the end of an url http: is dropped from the GET

Added by skinkie - almost 15 years ago. Updated almost 15 years ago.

Status:Closed
Priority:Low
Assignee:Marco Hugentobler
Category:Web Services clients/WMS
Pull Request or Patch supplied: Resolution:fixed
Easy fix?:No Copied to github as #:11793

Description

When http://something/ is written as url the GET request to the webserver doesn't contain http: instead GET //something/?SERVICE...

This causes the webserver to act as if //something/ was actually a webdirectory.

wireshark (35.2 KB) Giovanni Manghi, 2009-07-12 03:13 AM

History

#1 Updated by Giovanni Manghi almost 15 years ago

I'm sorry,

this is not clear to me. Could you be more specific, what component you are speaking about?

#2 Updated by skinkie - almost 15 years ago

I guess the component that creates the URL for the web request?

#3 Updated by Giovanni Manghi almost 15 years ago

What web request? wms?

#4 Updated by skinkie - almost 15 years ago

In this case it was WMS, but I didn't test if it also happens on a WFS request.

#5 Updated by Giovanni Manghi almost 15 years ago

I tested a few wms server urls (the ones added by default by qgis, among the others) by adding a trailing "/" and they work fine.

I used qgis >= 1.1

Please check it again and report back.

#6 Updated by skinkie - almost 15 years ago

Did you check it in wireshark what is the actual request, not what works at a random webserver?

#7 Updated by Giovanni Manghi almost 15 years ago

I'm not really into programs like wireshark, but I'll attach here the log produced by making two requests to the same server, one with the trailing slash, the other without.

Have a look and leave further feedback.

#8 Updated by skinkie - almost 15 years ago

Just checked out SVN; error is still there.

WMS URL: http://wms.openstreet.nl/

GET //wms.openstreet.nl/?SERVICE=WMS&REQUEST=GetCapabilities HTTP/1.1

Host: wms.openstreet.nl

User-agent: Quantum GIS - 1.2.0-Unstable Trunk

HTTP/1.1 200 OK

Connection: Keep-Alive

Keep-Alive: timeout=15

Transfer-Encoding: chunked

Date: Tue, 14 Jul 2009 15:40:01 GMT

Server: Cherokee/0.99.21b3444 (UNIX)

Content-type: text/html

1fc

<HTML>
<HEAD><TITLE>MapServer Message</TITLE></HEAD>
<!-- MapServer version 5.0.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=THREADS SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE -->
<BODY BGCOLOR="#FFFFFF">
msLoadMap(): Unable to access file. (/home/wms/mapfiles/wms.openstreet.nl/.map)
</BODY></HTML>

0

#9 Updated by skinkie - almost 15 years ago

Index: src/core/qgshttptransaction.cpp ===================================================================
--- src/core/qgshttptransaction.cpp (revision 11070)
+++ src/core/qgshttptransaction.cpp (working copy)
@ -133,9 +133,15 @
// http://www.address.bit:80), so remove that from the url before
// executing an http GET.

- QString pathAndQuery = httpurl.remove( 0, httpurl.indexOf( qurl.path() ) );

+ QgsDebugMsg( "qurl.path() is '" + qurl.path() + "'." );

+ QString pathAndQuery = httpurl.remove( 0, httpurl.indexOf( qurl.host() ) );
+ pathAndQuery = httpurl.remove( 0, pathAndQuery.indexOf( qurl.path() ) );

QgsDebugMsg( "pathAndQuery is '" + pathAndQuery + "'." );


if ( !postData ) //do request with HTTP GET {
header.setRequest( "GET", pathAndQuery );

The above fixes it, but if someone with real QT C++ skills can look at this, it would probably be better.

#10 Updated by Marco Hugentobler almost 15 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Applied in 3f3743bd (SVN r11072).
Thanks!

Marco

Also available in: Atom PDF