hoaproject / Http

The Hoa\Http library.

Home Page:https://hoa-project.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Double directory separator at the end of root.

Metalaka opened this issue · comments

There is a issue with the root path, it can be resolved by two function, and they don't return the same path style.
Http\Bhoa Line 178.

if('hoa://' == substr($_root, 0, 6))
    $_root = resolve($_root);
else
    $_root = $root = realpath($root);

realpath return the path without the last directory separator unlike resolve, who return the last directory separator.
So we can see some request uri like /.../Application/Public//index.php.

We should add a DS to $_root but not to $root in case of computed with realpath. And then remove some DS when computing variables like $target, $script_name.

Humm, can you give us a use-case please?

Always with Learning manual/Routerdispatcher#Apercu examples.
Start myapp http:bhoa --root hoa://Application/Public and curl 127.0.0.1:8888/hello,
the script filename header (sorry, I said request uri yesterday) will be:
/path/to/app/Application/Public//index.php.

Hmm, I remember about this when I coded this part. But, is it bad to have 2 slashes in the path?

It's work, so I don't know, but at my mind it's ugly :s

Also while reading Hoa\Core issues I see hoaproject/Core#28 (comment) who can change this.
If Hoa philosophy change to don't add a ending DS on all they path, resolve will not return the ending DS and we can close this issue.

Yes it's ugly to have two slashes ;-). Can you propose a patch or do I?