openwebwork/webwork2

Double slash

Closed this issue · 7 comments

With a 2.17 server using apache, these links both work:
https://webwork-hosting.runestone.academy/webwork2
https://webwork-hosting.runestone.academy//webwork2

With a 2.18 server using hypnotoad, the first of these works, but not the second:
https://webwork.pcc.edu/webwork2
https://webwork.pcc.edu//webwork2

And with a 2.18 server using hypnotoad and apache proxy, the first of these works, but not the second:
https://webwork-dev.uleth.ca/webwork2
https://webwork-dev.uleth.ca//webwork2

This came up as an issue in a PTX embedding situation where there was an extra slash for the href to an image. I have cleaned up in pretext so the extra slash is not there anymore, so that's fine now. But I wondered if this is something that could be configured with hypnotoad to behave more like apache. Or maybe this is better, and apache was being too forgiving?

(PS I swear I posted this as an issue last night, but I can't find it. I fear I posted it somewhere else in the wrong place... if anyone saw it in an alert, please show me where. Maybe I never hit submit,. Or maybe I was dreaming.)

A big of searching seems to be that a // in a URL should not be interpreted as a / since / separates parts of the URL and a // could mean there is a missing part between the slashes.

I guess you're only thinking of the beginning of the URL. Are the links with the // just bad links coming from other places? That is, that can be fixed?

Yes, I've fixed the instances of double slashes being created by some part of PTX (the ones that I know of). This happens when some URL is created by "manually" gluing strings together with a slash and it turned out one of the strings already had a slash. Usually there is a tool to create the path/url the "right way" though.

So it's not a high priority. Maybe it is not even something to 'fix". But I do wonder about this difference in behavior between hypnotoad and apache.

Are the paths internal from WeBWorK? or elsewhere?

What I know of was from elsewhere.

I guess you could see in the access logs where their coming from, correct?

I know exactly where these are coming from (the ones that we've encountered so far). This was happening with WW problems embedded in PTX books. And I've already stopped that from happening any more.

Processing of url paths prior to 2.18 was done by webwork2 code (in lib/WeBWorK/URLPath.pm). For 2.18 the routes are set in lib/WeBWorK/Utils/Routes.pm, but the processing of paths is done by Mojolicious. As such, there is no way to make a double forward slash be processed as a single slash without adding a messy hack. I agree with @pstaabp that this probably should not be done.