Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Minor problem with 'save destination as' for code.

by smiffy (Pilgrim)
on Oct 19, 2008 at 22:34 UTC ( #718100=note: print w/replies, xml ) Need Help??

in reply to Minor problem with 'save destination as' for code.


Please ignore the following, which was my error but I preserve for posterity. I have been assured that this site does not do browser sniffing and I apologise for jumping to conclusions (although it did seem to be the only logical answer) and if my tone may have seemed offensive.

Original Post (to be ignored)

If only it were that simple; the problem is deeper-rooted than one might think. I've done a couple of tests which make it look like the code driving this site is engaging in a form of anti-social behaviour called "browser sniffing"

Try taking the download link and retrieving it with wget or lynx -source or just plain GET if you have it on your system. It gets you a completely different thing to what you would expect based on experiences with a mainstream visual user agent (browser).

Why do I call browser sniffing antisocial? Because it is poor practice from a web accessibility point of view. Serving different content based on the value of $ENV{HTTP_USER_AGENT} takes control away from the user (never a good thing) and makes what we get unpredictable. Consider a blind person accessing this site using Lynx and EMACSpeak (I know personally at least one person who uses this combo). When they select the 'download' link, they will be presented with something quite unlike what they are expecting. Anyone who wants to see what happens should just open one of these download links in lynx. (For those who can't be bothered, you actually get taken to the Monastery Gates.)

I am not entirely sure why Perl Monks does this - I'm sure that the motives are honourable. However, browser sniffing a) discriminates against those using different user agents and b) is useless against robots as the first thing that a robot writer does is to make their software pretend to be Firefox, IE or Googlebot. Any of the site ops like to comment on why this is done?

At the end of the day, I can't say whether browser sniffing is causing your problem or not - it certainly doesn't help trying to trouble-shoot it. I only discovered it by chance, when trying to retrieve the download links using command line tools, in order to try to solve your problem.

Replies are listed 'Best First'.
Re^2: Minor problem with 'save destination as' for code.
by hossman (Prior) on Oct 20, 2008 at 00:59 UTC
    Try taking the download link and retrieving it with wget or lynx -source or just plain GET if you have it on your system. It gets you a completely different thing to what you would expect based on experiences with a mainstream visual user agent (browser).

    I don't know what you get, but i get exactly what i expect, and exactly what i'm getting when sniffing the traffic in firefox (the only exception being the lack of an X-Pad header which has nothing to do with PerlMonks doing any browser detection).

    Perhaps instead of making vague claims that PM is doing bad things and saying "see for yourself" you could be a bit more explicit and say "this is what i see ... and i think it's bad."

      I thought that I had made what I was getting clear but, if it was not, I apologise. (My original post actually states " actually get taken to the Monastery Gates".)

      The test I made was:

      • In Firefox, go to one of the 'Download' links in a node.
      • Right click the link.
      • From the context menu, select 'Copy link location'. (I have verified that what is copied is what shows at the bottom of Firefox when hovering over the link.)
      • Paste the link as an argument for 'lynx'.
      • Lynx loads the 'Monastery Gates' page, NOT the content of the <code></code> block to which the 'Download' link relates.

      The above behaviour is the same if the link is retrieved using wget.

      The main reason that I consider this behaviour bad is that the link target is other than expected (Monastery Gates, not content of <code></code> block.)

        That URL contains semicolons. My guess is that you didn't properly quote the URL. You'd get the gates if you didn't manage to keep the ";node_id=" as part of the URL passed to your GET tool.

        The site isn't doing "anti-social" "browser sniffing" (really, it isn't). I'll refrain from expressing with insulting terms the conclusions I've jumped to as to what you are doing. (:

        - tye        

Re^2: Minor problem with 'save destination as' for code.
by blazar (Canon) on Oct 20, 2008 at 11:11 UTC

    I see that you have duly updated your post: indeed I do hate "browser sniffing" too - there's been a time I have been called "the wgetter" because of my downloading habits. Back then, I stumbled upon a site that wouldn't let me download anything if I were not on either Exploder or Netscape, err... well... or Opera, I presume. Then I discovered how to send an arbitrary additional header; it was only later that the -U cli switch was added. But somehow you got me shocked yesterday! I was about to answer to the point of PerlMonks not behaving at all the way you described. Which in fact is the case! Indeed, the header I pasted in the root node of this thread was the output of a wget -S! Notwithstanding the fact that I have Live http Headers installed... ;)

    If you can't understand the incipit, then please check the IPB Campaign.

      Ooh, cool tool! /me installs livehttpheaders. Thanks for that.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://718100]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2017-12-17 15:04 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (464 votes). Check out past polls.