http://www.perlmonks.org?node_id=1014305


in reply to Perlmonks 'Not logged in Error' - Proposal for fix

How about having [http://(www\.)?perlmonks.(org|net|com)/(.+)] be rendered the same as [href:///$2] ? The next step would then be to filter <a href=...> similarly (such are already fully parsed and so can be reliably filtered).

I tend to prefer to fix the rendering over changing the text that users have entered. It automatically fixes old nodes and getting it wrong in some way doesn't leave garbage saved that then has to be found and cleaned up.

Though I also see value in having perlmonks.org redirect to www.perlmonks.org but I suspect that will annoy a few people. I'd rather go in that direction than from www.perlmonks.org to perlmonks.org as it leaves open the unlikely possibility of wanting DNS entries for perlmonks.org to be less specific than "for web traffic", despite the trend for dismissing any such future possibilities.

If such a redirection is implemented, then the destination page probably also needs to re-issue a cookie, which complicates things. Though maybe not. It seems that cookies for perlmonks.org will work for www.perlmonks.org (that isn't always the case in the other direction, which could be another reason for standardizing on www.perlmonks.org as google already does -- because I told them to).

- tye        

Replies are listed 'Best First'.
Re^2: Perlmonks 'Not logged in Error' - Proposal for fix (link render)
by LanX (Saint) on Jan 20, 2013 at 20:42 UTC
    > How about having [http://(www\.)?perlmonks.(org|net|com)/(.+)] be rendered the same as [href:///$2] ? The next step would then be to filter <a href=...> similarly (such are already fully parsed and so can be reliably filtered).

    Practically the server side equivalent of my nodelet hack? If it's easily feasible it's IMHO the best over all idea.

    You may want to consider an exception rule (like #no_redirect at the end of the URL) to allow people to hard-link domains w/o conversion.

    Cheers Rolf

      Practically the server side equivalent of my nodelet hack?

      IMHO the difference is that in the nodelet hack the load is distributed amongst the clients whereas otherwise its taken up by the server. ( A good thing )

      But considering that this entire thing might be something that newbies will find useful, it might make sense to have it as part of some default JS loaded.

      A server side redirect though, will cause less load and will solve this even for those accessing the site through some automated means. ( other than through a browser )

      You may want to consider an exception rule (like #no_redire­ct at the end of the URL)

      That's actually why I didn't include (:80)? in the proposed regex.

      - tye        

        Yep (:80)? sounds good!

        Cheers Rolf

Re^2: Perlmonks 'Not logged in Error' - Proposal for fix (link render)
by tmharish (Friar) on Jan 21, 2013 at 03:35 UTC
    If such a redirection is implemented, then the destination page probably also needs to re-issue a cookie

    If we did this server side then anyone landing on perlmonks.org would get redirected to www.perlmonks.org and no one would ever login on perlmonks.org. We could make this a 301 permanent redirect.

    I tend to prefer to fix the rendering over changing the text that users have entered. It automatically fixes old nodes and getting it wrong in some way doesn't leave garbage saved that then has to be found and cleaned up.

    The only problem with this could be the additional load on the server. For each page rendered the code will have to additionally check :

    $node_contents =~ s/(http:\/\/)?(www\.)?(perlmonks\.)(org|net|com)\/(. +*)/$1www.perlmonks.$4\/$5/g;
      anyone landing on perlmonks.org would get redirected to www.perlmonks.org and no one would ever login on perlmonks.org.

      I realize that. Do you realize that there are already people with existing cookies from perlmonks.org?

      The only problem with this could be the additional load on the server.

      The device has yet to be invented that could notice that miniscule of a difference in server load.

      - tye        

        Do you realize that there are already people with existing cookies from perlmonks.org?

        There are two ways to handle that: either don't redirect if the cookie is set, or simply force them to log in one more time.

        I really hope you don't take it as a reason not to act.

        Do you realize that there are already people with existing cookies from perlmonks.org?
        Uhm... so....? We're not using this solution because everybody with a cookie on perlmonks.org would have to login once more?
        The device has yet to be invented that could notice that miniscule of a difference in server load.
        There is the redirect solution. It doesn't cost anything and would work also for links posted somewhere else.

        There is the explicit-domain-cookie-solution. It doesn't cost very much cpu (just check the server host and decide which cookie domain); it only needs some code (I can't estimate since I don't know the existing code). It also works for links posted somewhere else.

        Still you favor the solution which costs the most cpu (and probably the most coding) and which only works for links posted on this site, because you think the load is not measurable? That's kindof like saying, as a european (or american, ...) I still want to drive my big car because it's of no use to save gas, there are much more cars in china, so if they don't save gas, I shouldn't either.
        Do you realize that there are already people with existing cookies from perlmonks.org?

        We simply expire all active sessions and everyone logs back in ONE time.

        The device has yet to be invented that could notice that miniscule of a difference in server load.

        I have no idea what the current server loads are and what the exact site traffic is, not to mention the fact that I dont know how the current rendering is done so that was an uneducated guess on my part.