05/15/06: Rails / lighttpd gotcha: AJAX stalling? Check your Content-Length headerSo neither Ruby on Rails nor lighttpd set the Content-Length header in HTTP responses on their own. That means that the browser doesn't know when it's gotten the whole response, so it has to keep the connection open in case more bytes come down. In normal web usage this doesn't cause a problem (*) since browsers are smart enough to display partial results. But for AJAX responses it means that, sometimes (**) the onComplete handler (***) doesn't get called for over a minute. The onInteractive handler gets called quickly, but that doesn't help, since usually you do stuff during onComplete when you're guaranteed to have the full response.
Here's the fix in Rails. Put the following in your application.rb:
after_filter :set_content_length def set_content_length @response.headers['Content-Length'] = @response.body.length endAnyone who wants to fix the above to check for an existing content-length, be my guest :-)
(**) The stalling happens sporadically, not sure with what pattern. In one app we saw it maybe one in 5 requests; some of those were actually HTTP requests so the
(*) Occasionally the page will be fully visible but the cursor will still be a pointer-plus-spinning-hourglass. And this may cause performance problems in high-volume sites.
(***) onInteractive and onComplete are prototype.js event callbacks; the corresponding standard XMLHttpRequest "ready states" are INTERACTIVE and COMPLETE; "ready state" is a parameter to the onReadyStateChange callback.
Even the college sports teams inevitably started to produce snapbacks of their schools and universities. This led to the snapback cap gaining enormous popularity during the 1980's through the 1990's, even with the fitted hats being extremely well taken.
People should be able to wear the hat in a range of situations as well, whether are out neighborhood with the kids, playing a round of golf, or walking throughout the grocery store.
Nothing provides more satisfaction than purchasing a branded accessory at discounted prices. And if the accessory you are buying are the world Fake Oakley Sunglasses, then you've got all the more reason to feel excited. Why? Because you're going to own a glamorous pair of shades which will ensure everlasting protection for your eyes. How? This is due to the brand's commitment in undertaking research to develop cutting-edge optical technologies in their glasses. As a result, Replica Oakley Sunglasses are today considered one of the best when it comes to vision care.