SWI-Prolog / packages-http

The SWI-Prolog HTTP server and client libraries
23 stars 23 forks source link

Http_reply_from_files/3 should return 301 Moved Permanently on directories without trailing / #142

Closed ntgiwsvp closed 4 years ago

ntgiwsvp commented 4 years ago

http_reply_from_files/3 from library(http/http_files) should first return a moved (301 Moved Permanently) reply in case the URL to a directory is missing the trailing /. This is currently (as of f1110a2341388fb74c492e08ae3e09a0678c4828) only the case if the directory has no index file, when the index is created via http_reply_dirindex/3. In case the directory has an index file, the index file is served without any further redirect. This is annoying, for example since relative links in index.html pages point to the wrong direction if the user omits the trailing /.

(See https://swi-prolog.discourse.group/t/http-reply-from-files-3-should-return-301-moved-permanently-on-directories-without-trailing/2878 for the original post.)

JanWielemaker commented 4 years ago

This issue has been mentioned on SWI-Prolog. There might be relevant details there:

https://swi-prolog.discourse.group/t/http-reply-from-files-3-should-return-301-moved-permanently-on-directories-without-trailing/2878/2

ntgiwsvp commented 4 years ago

Yes, I know, that was my post. :-) (I was at some point in time a bit paranoid about data protection issues and took the habit of just creating a new random user name for any website I register. Sorry if this is confusing.) Anyway, I think I found a quick fix, see the pull request. --Thomas

JanWielemaker commented 4 years ago

Yes, I know, that was my post. :-)

This is done automically. Guess that should not be associated to my account :(. Closed by your PR.