Safari Cache-Control:must-revalidate bug

Update Apr 8 2009: Apparently this bug existed in previous Safari versions (at least back to 3.1), i.e. including “must-revalidate” in Cache-Control means Expire and max-age will both be ignored by Safari. Here’s the Apple bug, if you happen to be an employee. I created an Apple account but still couldn’t find it.

Short version: Safari 4 beta incorrectly interprets the Cache-Control “must-revalidate” directive and re-requests the file each time despite freshness info sent via “max-age”.

Long version

When a server sends Cache-Control with “must-revalidate”, this tells clients/caches that, after it expires, the cached resource should not be used without first checking with the server (sending a conditional GET). From the spec (my emphasis):

When the must-revalidate directive is present in a response received by a cache, that cache MUST NOT use the entry after it becomes stale to respond to a subsequent request without first revalidating it with the origin server. [HTTP/1.1]

In other words, while the cache is fresh, there’s no need to revalidate.

E.g. I serve this Javascript file with the header “Cache-Control: public, max-age=1800, must-revalidate”. This tells clients: “consider this fresh for 30 minutes, then check back before using it again”. Unless you force a refresh, the browser won’t re-request the file for 30 minutes, after which it will send a conditional GET request. If the file hasn’t changed, the servers returns a “304 Not Modified” and the same Cache-Control header. This tells the browser to keep using the cache for another half hour and check back again. (Yes, half an hour is too short, I’ll change this later.)

Well, Safari 4 beta re-requests the file each time it needs it, seemingly ignoring the “max-age” directive. At least it’s sending a conditional GET, but it’s still a waste of bandwidth and time.

Plan Juarez

If you haven’t noticed, Juarez and many other Mexican cities are facing a violent crisis. The drug cartels are so well funded and armed that they can bribe officials and even threaten police chiefs into retirement. The drugs moved by the traffickers can, of course, cause harm, but Mexico’s problem isn’t a “drug problem” but rather a prohibition problem.

The relatively rich people of U.S. and Canada create a huge demand for drugs, both government regulated and illegal. By waging war on some drugs, we outsource much of our illegal drug production to South America. Mexico has traditionally given lip service to our prohibition, but not devoted much to the effort in practice, forcing the U.S. deal with the problem on our side of the border and in Colombia. This allowed the cartels to work in relative peace for many years, but this was still unacceptable to former president Vicente Fox. Fox battled the cartels and managed to unseat a few kingpins, which only led to more violence. When Calderón replaced Fox in 2006, he declared his own war on the cartels, calling in federal troops to replace the police and greatly escalating the war.

U.S. officials and drug warriors, of course, find the violence acceptable. “There will be more violence, more blood, and, yes, things will get worse before they get better. That’s the nature of the battle,” said U.S. Ambassador Tony Garza. (Would these people find it acceptable if thousands of U.S. citizens were dying and living in a police state to prohibit sales of goods to Canadians?)

A Solution for the People of Mexico

It is not your money, guns, or addictions that are feeding the violence in your country. I propose that you end the war on your fellow citizens.

  1. Create a license to legally produce and traffic “illegal” drugs strictly for export to the U.S.
  2. Allow licensees to freely operate, but with taxes and rules, while continuing to fight unlicensed organizations.
  3. Allow law-based disagreement resolution mechanisms and revoke licenses from organizations linked to violence.

In other words, you should make your narcotraficante industry look more like UPS and Budweiser than Al Capone’s Chicago Outfit.

Resistance to such a policy would come primarily from key players in the drug war. Your cartels will want to maintain control, but their profits will die as non-violent businessmen take up licenses and take their business. Our DEA may suggest closing your border or even replacing your government by force; we’ve done it before.

In the end you’ll have to decide what is in the best interest of your people. Is it worth their lives and the very stability of your government to prevent Michael Phelps from hitting a bong?

Sorry Jerks, Intimidation Won’t Change the Web

Shameful law firm Jones Day sued real estate news site BlockShopper claiming “trademark infringement” over the way the site used link text, but really because the firm didn’t like how the site reported the home purchases of their partners (which is public record). The case should’ve been thrown out, but the judge allowed it, and, in doing so, allowed the firm to bleed the site of $110K in legal fees. BlockShopper finally agreed to settle out of court and to format its links to the firm in a particular way.

…it signals to companies that they can force sites to revise their linking styles by alleging trademark infringement. And Judge Darrah’s decision not to dismiss the suit signals that Web publishers may have to spend significant sums to deal with this kind of litigation. [Slate]

Paul Levy noted the law firm is “a serial abuser of the trademark laws to suppress commentary that it does not like.”

Personally, I would’ve just used this URL to link to the bullies: E.g., “Paul W. Schroeder likes to strongarm web authors.” Or you could use a 3rd party redirect site like In fact, there should be a redirector designed to shame site owners who attack linkers like this.

Update: We now have one:

E.g.: Paul W. Schroeder.

Zero Tolerance Nets Another Slimebag

What if we had zero tolerance for laws that have a lot of ugly side effects? Like busting an amazing teacher in front of her kids… for finding a couple Xanax pills… in a suspicion-less search of her car.

Herrick, 59, has taught at Roberts for 17 years. Parents describe her as “inspirational,” “talented” and “loving.”

She comes to work early so kids can finish projects they didn’t have time to complete in class. So many kids wanted to join her after-school art club that it had to be restricted to fifth-graders. More than one parent tells how she dropped by a student’s house, bearing art books that she thought might be of interest.

She’s a ferocious doubles tennis player, nationally ranked, so fanatical about her game that she hesitated a year before taking cholesterol meds that her doctor prescribed.

In 1995 and 1999, Herrick was Roberts’ teacher of the year. For 2005-06, she was teacher of the year for HISD’s entire Central District. And in 2009, she was busted.

In the middle of a class, police escorted her from her classroom. After she unlocked her car, police found a baggie with two Xanax pills.

Herrick said she has no idea how the pills got into her car, which other people in her family drive.

But no matter. She was hauled away from the school she loves in the back of a squad car and charged with possession of a controlled substance within 1,000 feet of a school. If convicted of that third-degree felony, she could serve two to 10 years in prison.

Even though she’s passed the drug test and a lie detector test, she’s out of the classroom for the time being. As Pete Guither writes, “It’s, you know, for the kids.

What if she does have a Xanax problem? Having teachers like this lady, personal habits and all, is what builds kids that never need to try drugs. How about the experience of watching your favorite teacher taken to jail? or growing up a paramilitary police state?


If this National Review article is accurate, the stimulus bill is worse than I was imagining. It’s not that I’m against every piece of it, but wrapping up countless unrelated projects under one bill and/or pushing it through Congress as an “emergency remedy” is a terrible way to create laws.

This is how we got the Patriot Act and the Commodity Futures Modernization Act of 2000.

Although the right is ablaze over this, I think I’m a little too cynical to believe that there’s a good/evil party boundary in this. I fear it’s in times like these that both parties will “reach across the aisle” and push through pet projects via a monumental bill to tell citizens they “did something about the recession”. It’s the minority party’s role to “oppose” and break out their own pens to fair it up.

If the Senate Reps oppose this with the same zeal, they’ll win some respect from me. If it passes, for years to come we’ll be discovering wonderful new treasures similar to the Enron loophole and unregulated credit default swaps, and plenty of junk both parties are opposed to. We’ve already found a revival of the Byrne grants frequently abused in our drug war.

I don’t see how any elected official can look us in the eye and say, “all this is what we need and we need it immediately, there’s no time to read the fine print.”

New general rule: the level of debate and time for press scrutiny of a bill should be proportional to its scope. Maybe there should even be some limitation of scope within a single bill.