4 ms·
That behavior shouldn't get you banned, but some of your requests will get dropped if you make too many too quickly. You will see 304s for static resources, li
by kogir 14y ago
That behavior shouldn't get you banned, but some of your requests will get dropped if you make too many too quickly.
You will see 304s for static resources, like images and CSS. Efficiently handling HEAD requests for dynamically generated pages is actually painful, and many frameworks support it by handling the request like a GET and just omitting the body. In our case, most pages contain fnids and will never be the same twice anyway.
- jacquesm 13y agoIt can get you banned and here is the fix: https://news.ycombinator.com/item?id=4761102 https://news.ycombinator.com/item?id=4761102
- jedberg 13y agoWell, it drops every request I make for about 12 hours, so that's equivalent to a ban. :) And I'm aware of how painful it is to handle HEAD requests for a dynamic page, having had to deal with it on reddit. There are some easy hacks to make it work pretty well. One is to just keep a cache of the last update time of each page, and then use that cache when you get a HEAD request. I'm not sure what an fnid is, but if you have something on the page that changes so quickly that the hash changes when the content doesn't, then I'd contend you're doing something wrong.
- bri3d 13y agoPG and friends are using Continuations ( http://en.wikipedia.org/wiki/Continuation http://en.wikipedia.org/wiki/Continuation ), which are supported first-class in Racket, as the pattern underlying HN. Their specific implementation of continuations means that each time a page is generated, each user-specific/authenticated link off of the page (Flag, Voting, Delete) is evaluated as a possible continuation of the user's state and the user-and-action specific hash "fnid" (Function ID) is cached and interpolated into the HTML. Hence, the hash absolutely changes for every logged-in user every page load. Lots of older sites still use continuations to great effect; Continuations were popular in the WebObjects days but since they require lots of user state information to be stored server-side they're comparatively difficult to scale. Continuations are a really cool pattern to study, since most hacking in HTTP-backed web services comes from the inherently stateless nature of the protocol, and continuation-based programming helps prevent the inverted control flow that page-based programming lends itself to.
- born2web 13y agoActually, it does get one banned. It happened to me once and it was the most nerve wracking experience trying to figure out what exactly happened and why i was separated from my favorite site. I came up with the following simple :-) hack: When there is a need to open a bunch of HN links (either saved tab sessions or more importantly when restoring a crashed browser session), I disconnect the network connection. Once all the tabs are launched, I turn the network connection back on and refresh each tab when i get around to reading it.