Opened 15 years ago

Closed 15 years ago

#1733 closed patch (fixed)

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

Reported by: skinkie Owned by: mhugent
Priority: major: does not work as expected Milestone: Version 1.2.0
Component: WMS Version: Trunk
Keywords: http dropped end slash Cc: pcav
Must Fix for Release: No Platform: Debian
Platform Version: Awaiting user input: no

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.

Attachments (1)

wireshark (35.2 KB ) - added by lutra 15 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by lutra, 15 years ago

Cc: pcav added

I'm sorry,

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

comment:2 by skinkie, 15 years ago

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

comment:3 by lutra, 15 years ago

What web request? wms?

comment:4 by skinkie, 15 years ago

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

comment:5 by lutra, 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.

comment:6 by skinkie, 15 years ago

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

comment:7 by lutra, 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.

by lutra, 15 years ago

Attachment: wireshark added

comment:8 by skinkie, 15 years ago

Component: Build/InstallWMS

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

comment:9 by skinkie, 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.

comment:10 by lutra, 15 years ago

Milestone: Version 1.2.0
Owner: changed from nobody to mhugent
Type: bugpatch

comment:11 by mhugent, 15 years ago

Resolution: fixed
Status: newclosed

Applied in r11071. Thanks!

Marco

Note: See TracTickets for help on using tickets.