Tuesday, April 27, 2010

HTTP Headers are a multi-map

:Link to Article:
RFC 2616:
Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma.
Today, I found and fixed a cool bug in the AmazonCloudFront client for .NET. The original implementation of the client used the System.Net.WebHeaderCollection.Add() method to specify headers for a CloudFront request. An example of one of the request headers is If-Match - this header uniquely identifies a CloudFront distribution, and the value associated with this header is the ETag specified for the request.

Using the Add method is fine if a new request object is created for every CloudFront request; the issue arises when an attempt is made to reuse an existing SetDistributionConfigRequest object to perform another CloudFront request, albeit with new parameters. In the reuse case, the new header values will be appended to the existing headers' values.

Let's take the case of If-Match: when the request was sent over HTTP, CloudFront received a comma-separated value for If-Match containing all the ETags specified during the lifetime of the request object. When CloudFront received this string, it couldn't verify the identity of the distribution, and rejected the request.

The fix: Use the WebHeaderCollection's [] accessor to set a unique value for every request header. Fixing this bug makes it now possible for the same request object to be reused for multiple calls.

Friday, April 02, 2010

Critiquing the iPad, and getting it wrong!

:Link to Article:
I like Cory Doctorow, especially his unique take on technology and all things geek. In fact, Boing Boing was the first RSS feed I subscribed to, ever! His latest piece on why he dislikes the iPad is a miss though; he doesn't get some basic tenets of why the iPad will succeed.
if you can't open it, you don't own it.
I consider myself to be quite the technophile, but when it comes to unscrewing the back off my laptop and fiddling with its innards, I *seriously* consider my alternatives. Most people that own computers panic when it runs slowly, panic even more when they get a Virus alert, and suffer a melt-down when their computer crashes or their hard drive fails. You think the average computer owner can bring out their screwdriver set and start tinkering with their computer? A laptop or desktop, as open as a hardware platform as can be, is still very intimidating to a regular Joe.

The iPhone was criticized for being a closed hardware and software platform. Did this stop the really inclined tinkerers from peeking inside and figuring out how these devices worked? No! For proof of this phenomenon, you don't have to go farther than Mumbai's grey market. For a very fair price (10 - 20 US$), you can pick from a number of "technicians" who can open your iPhone, replace your battery, tweak the hardware settings on the LCD, jailbreak the device, et al. Mumbai, Delhi, Moscow, Seattle - hardware geeks everywhere know everything they need to repair an iPhone, to hack an iPhone, to replace the software on the iPhone. What's that about not being able to customize the device?
The way you improve your iPad isn't to figure out how it works and making it better. The way you improve the iPad is to buy iApps. Buying an iPad for your kids isn't a means of jump-starting the realization that the world is yours to take apart and reassemble; it's a way of telling your offspring that even changing the batteries is something you have to leave to the professionals.
Isn't that what you do with a car, or a TV, or a DVD player, or a clock radio, or ... Why is this a bad thing? Why is it such a blasphemy that a device is locked down so as to enable scenarios that make it simpler to use and interact with than any other device available? In this age of information overload, the iPad offers me the ability to never have to learn how to make it work other than pressing its power button. Brain cells saved only to be wasted on something else that might help me find a job or improve my life!

What made me write this post though was this paragraph:
But with the iPad, it seems like Apple's model customer is that same stupid stereotype of a technophobic, timid, scatterbrained mother as appears in a billion renditions of "that's too complicated for my mom" (listen to the pundits extol the virtues of the iPad and time how long it takes for them to explain that here, finally, is something that isn't too complicated for their poor old mothers).
My mother isn't stupid, but she does struggle with using a computer. When did our measure of stupidity become proficiency with a computer? My mother could whoop most people's behinds when it comes to most things not related to using her computer; that she can't use her computer is not so much her fault as it is the fault of Microsoft or Apple or the other software makers. But I would buy the iPad for her, like I would buy an iPhone for her. She took to my iPhone and my Macbook Pro like a duck takes to water. In fact, my mom doesn't know how to use Copy/Paste and until a few days ago, didn't even think she needed such functionality!

April 3rd is tomorrow, and let me tell you something - the iPad will sell, and the 2nd version of the device will outsell its predecessor, and so on. When I used to walk around the 1st Gen iPhone, my friends used to mock me. These same friends now connect to the world with said iPhone. We have severe technological amnesia - being critical of something today doesn't preclude owning the thing tomorrow (or a year from now). I hope Cory wakes up and smells the coffee at some point; the rest of us common folk have already seen the light.