Think of everything but the obvious first
Today's revelation while tinkering with my PersonalWebProxy: Decompressed content is larger than compressed content.
See, I was decompressing gzipped content streams in the proxy in order to fiddle with the content before it got to the browser, but then I noticed that browsers kept only displaying part of the content. I remove the in-proxy decompression, things are fine. Put it back in, things get cut short. I poke for a few hours at various bits and parts, to no avail.
Then, finally I remember... "Hey, you know, I think browsers pay attention to that Content-Length header. And hey, you know... decompressed content is larger than compressed content." Bingo. Problem solved by keeping the Content-Length header updated with the length of modified content. This makes me feel very dumb, because it's not like I haven't written a handful or two both of HTTP clients and servers. And I've written code that uses the Content-Length header, over and over again. I'd've thought this would be something I'd remember more quickly.
More often than I'd like to admit, remembering simple and obvious things like the above are what unlock problems that I'd been banging my head against. The last revelation of this nature I had while frustrated at a project at work was: "Not all months are 31 days." And before that, "Not all days in a year are 24 hours long, due daylight savings time."
Trying to think of more, but I thought I'd share. Maybe I'll start a wiki topic for sage bits of the ObviousInHindsight.
shortname=oooceg
Archived Comments