Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inets httpd: dir listing href %2F #4677

Closed
gertcuykens opened this issue Mar 26, 2021 · 5 comments
Closed

inets httpd: dir listing href %2F #4677

gertcuykens opened this issue Mar 26, 2021 · 5 comments
Assignees
Labels
bug Issue is reported as a bug in progress team:PS Assigned to OTP team PS

Comments

@gertcuykens
Copy link

gertcuykens commented Mar 26, 2021

Describe the bug
All index href attributes have '%2F'...

image

image

image

image

To Reproduce

inets:start()
{ok, Pid} = inets:start(httpd, [{port, 8080},
                                {server_name,"httpd_server"},
                                {server_root,"/Users/gert/erlang/pgsql"},
                                {document_root,"/Users/gert/erlang/pgsql/doc"},
                                {bind_address, "localhost"}]).

Expected behavior
No %2F in href attribute

Affected versions
Erlang/OTP 23 [erts-11.1.8]

Additional context
OSX

@gertcuykens gertcuykens added the bug Issue is reported as a bug label Mar 26, 2021
@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Mar 29, 2021
@KennethL
Copy link
Contributor

Can you please elaborate more exactly what you think is wrong?
Is it the output from http://localhost:8080/%2Findex.html?

@gertcuykens
Copy link
Author

gertcuykens commented Mar 29, 2021

Thanks for looking into it.
image
All the url's are wrongly escaped. When you inspect the href attributes should have been / instead of %2F

Also not sure if dumping it in a pre tag is optimal as you can see the layout is not aligned. I believe this was done as a quick temporary solution until somebody has time to create a proper index page generator?

The use of hardcoded image icon url's probably not the best way to go? Maybe remove or replace with unicode characters?

@liangdefeng
Copy link

liangdefeng commented May 11, 2021

As to the %2F, I met the same issue and below is my temporary solution to it for reference.

In the mod_dir.erl codes, apply the changes which has the following pattern.

change before
get_href(RequestURI ++ "/" ++ InitEntry ++ "/")

change after
get_href(RequestURI) ++ "/" ++ get_href(InitEntry) ++ "/"

@u3s
Copy link
Contributor

u3s commented May 11, 2021

Thanks for sharing the suggestion.
Fix will be delivered after the release happens - I have the selected the same way of solving the issue.

@u3s
Copy link
Contributor

u3s commented May 20, 2021

Href fix pushed. For alignment and icon problem I will create new improvement issue soon - we would like to postpone it and see if we can get some community contribution in that area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug in progress team:PS Assigned to OTP team PS
Projects
None yet
Development

No branches or pull requests

5 participants