Skip to content

Conversation

@butonic
Copy link
Member

@butonic butonic commented Jun 14, 2017

From https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2

To allow for transition to absoluteURIs in all requests in future versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI form in requests, even though HTTP/1.1 clients will only generate them in requests to proxies.

Currently, this happens:

{"Message":"Requested uri (http:\/\/localhost\/owncloud\/remote.php\/webdav\/) is out of base uri (\/owncloud\/remote.php\/webdav\/)","Code":0,"Trace":"
#0 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(1279): Sabre\\HTTP\\Request->getPath()
#1 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(464): Sabre\\DAV\\Server->checkPreconditions(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))
#2 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(254): Sabre\\DAV\\Server->invokeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))
#3 \/var\/www\/owncloud\/apps\/files\/appinfo\/remote.php(83): Sabre\\DAV\\Server->exec()
#4 \/var\/www\/owncloud\/remote.php(132): require_once('\/var\/www\/ownclo...')
#5 {main}","File":"\/var\/www\/owncloud\/3rdparty\/sabre\/http\/lib\/Request.php","Line":210}

Also see client Issue: owncloud/client#3881

Test with absolute.php (adjust $host, $user, $password and $path as necessary, only works against http )

<?php
$host = 'localhost';
$user = 'user';
$password = 'password';
$path = "http://localhost/owncloud/remote.php/dav/files/$user/welcome.txt";
#$path = "/owncloud/remote.php/dav/files/$user/welcome.txt";

$fp = fsockopen($host, 80);

fputs($fp, "GET $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Authorization: Basic ".base64_encode("$user:$password")."\r\n");
fputs($fp, "Accept: */*\r\n");
fputs($fp, "\r\n");

$result = '';
while(!feof($fp)) {
    $result .= fgets($fp, 128);
}

fclose($fp);

echo $result;

This PR ignores the host, as the OC::$WEBROOT ignores it as well.

@DeepDiver1975
Copy link
Member

the same applies to the old endpoint as well ....

@DeepDiver1975
Copy link
Member

[Mon Jun 19 11:38:36 2017] Undefined index: query at /home/deepdiver/Development/ownCloud/master-autotest/apps/dav/lib/Server.php#80
[Mon Jun 19 11:38:36 2017] Undefined index: fragment at /home/deepdiver/Development/ownCloud/master-autotest/apps/dav/lib/Server.php#80

@PVince81
Copy link
Contributor

shouldn't this be part of Sabre instead ?

@DeepDiver1975
Copy link
Member

shouldn't this be part of Sabre instead ?

quite valid question .... but who will answer this :-(

@PVince81
Copy link
Contributor

quite valid question .... but who will answer this :-(

the ghosts of Webdav past

submit a ticket upstream ?

@PVince81
Copy link
Contributor

PVince81 commented Jul 4, 2017

or maybe it's our base uri that is wrong ?

@PVince81 PVince81 added this to the development milestone Jul 4, 2017
@DeepDiver1975 DeepDiver1975 self-assigned this Jul 19, 2017
@DeepDiver1975 DeepDiver1975 force-pushed the respect-rfc2616-section5.1.2-absoluteURI branch 2 times, most recently from 94c0380 to dd71f20 Compare July 21, 2017 12:42
@michaelstingl
Copy link

@DeepDiver1975 any news?

@DeepDiver1975
Copy link
Member

there is one failing test which needs attention - see https://jenkins.owncloud.org/job/owncloud-core/job/core/job/PR-28131/3/

on it ....

@DeepDiver1975
Copy link
Member

php is killing me ... https://bugs.php.net/bug.php?id=70942

@PVince81
Copy link
Contributor

classic... we had to put a workaround in Sabre URI code because of that...

@DeepDiver1975
Copy link
Member

classic... we had to put a workaround in Sabre URI code because of that...

oh - mind pointing me to the fix?

@PVince81
Copy link
Contributor

here owncloud-archive/3rdparty#285

@DeepDiver1975
Copy link
Member

here owncloud-archive/3rdparty#285

thx

@DeepDiver1975 DeepDiver1975 requested review from PVince81 and removed request for DeepDiver1975 August 1, 2017 10:03
} else {
$components = parse_url($uri);
if ($components === false) {
$components = parse_url("http://localhost$uri");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localhost ?

If this is legit, please add a PHP comment to explain what and why

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to trick the parse_url function - will add comment

@DeepDiver1975 DeepDiver1975 force-pushed the respect-rfc2616-section5.1.2-absoluteURI branch from 98477a4 to 718b0c3 Compare August 1, 2017 10:12
Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@PVince81 PVince81 merged commit d1dbcdd into master Aug 2, 2017
@PVince81 PVince81 deleted the respect-rfc2616-section5.1.2-absoluteURI branch August 2, 2017 07:47
@PVince81
Copy link
Contributor

PVince81 commented Aug 2, 2017

does backporting make sense ? not critical afaik

@DeepDiver1975
Copy link
Member

we need this at least in stable10 - @michaelstingl 9.1 as well?

@michaelstingl
Copy link

9.1 as well?

I've no request for 9.1.x

@michaelstingl
Copy link

Will this be in 10.0.3 release?

@DeepDiver1975
Copy link
Member

Will this be in 10.0.3 release?

yes

@lock
Copy link

lock bot commented Aug 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants