Closed Metalaka closed 9 years ago
Hello :-),
Are we sure that the resolve
function will add a DS
(if this is a directory)? I don't think so… maybe you could rtrim /
and \
, and append DS
.
The return value of resolve
is strange, or at least not fully normalized for hoa://Application*.
So if it's not normal, we must close this PR and open another into Hoa\Core
to normalize resolve
.
Hoa protocol (local):
$ php Hoa.php Core:resolve hoa://Application/Public
hoa://Application/Public is equivalent to:
/var/www/hoa-learn/Application/Public/
$ php Hoa.php Core:resolve hoa://Application/Public/
hoa://Application/Public/ is equivalent to:
/var/www/hoa-learn/Application/Public/
$ php Hoa.php Core:resolve hoa://Application/Public///
hoa://Application/Public/// is equivalent to:
/var/www/hoa-learn/Application/Public/
$ php Hoa.php Core:resolve hoa://Data/Bin
hoa://Data/Bin is equivalent to:
/var/www/hoa-learn/Data/Bin
$ php Hoa.php Core:resolve hoa://Data/Bin/
hoa://Data/Bin/ is equivalent to:
/var/www/hoa-learn/Data/Bin
$ php Hoa.php Core:resolve -E hoa://Application/FakeDir/
hoa://Application/FakeDir/ is equivalent to:
/var/www/hoa-learn/Application/FakeDir
Hoa protocol (global):
$ php Hoa.php Core:resolve hoa://Library/Core
hoa://Library/Core is equivalent to:
/usr/local/lib/Hoa/Core
$ php Hoa.php Core:resolve hoa://Library/Core/
hoa://Library/Core/ is equivalent to:
/usr/local/lib/Hoa/Core
File system:
$ php Hoa.php Core:resolve /var/www/hoa-learn/
/var/www/hoa-learn/ is equivalent to:
/var/www/hoa-learn/
$ php Hoa.php Core:resolve /var/www/hoa-learn
/var/www/hoa-learn is equivalent to:
/var/www/hoa-learn
So, first, are we agree that a trailing slash must be added if this is a directory? This is for security reason.
ping
If we say "must be added if this is a directory", so in a first time resolve
must return a trailing slash if this is a directory?
/ping @Hywan
At my mind it's better to normalize resolve
,
maybe do that while optimizing Hoa with PHP 5.4 ?
Yes we have to normalize this. So yes, if it is a directory, we have to add a trailing slash. This is why we do in Hoa. What is the next step?
Core#41 | Drop PHP5.3
.resolve
behaviour will be patched.What need to be patched?
(ahhh, I am lost with all these PR :-p).
resolve
must return a path with a trailing DS only when it's a directory.
@Metalaka Yup, useless since PHP has its own build-in HTTP server.
Useless yes, but cool :D
Sorry, didn't check the conflict with your PR :-(!
PR for https://github.com/hoaproject/Http/issues/3.