

Ask HN: Typo in Facebook's HTTP header "X-Cnection: close" intentional? - gary4gar
http://i.imgur.com/uuUHv.png

======
julian37
See here for a likely explanation:
<https://forums.aws.amazon.com/message.jspa?messageID=81954>

[http://www.nextthing.org/archives/2005/08/07/fun-with-
http-h...](http://www.nextthing.org/archives/2005/08/07/fun-with-http-headers)

<http://news.ycombinator.com/item?id=1913284>

~~~
gary4gar
in the link says

"FYI, the reason it misspells the word connection is so that the internet
check-sum (a simple sum) still adds up, this way the change can occur at the
packet level. If it completely removed the header, it would have to stall
forwarding the response until the header was entirely read, so it could
rewrite the headers, recompute the checksum and then send it along."

Wow, I am impressed. it is really a clever hack! Thanks for the link :)

~~~
julian37
You're welcome. However, the checksum doesn't work out for "X-Cnection":

    
    
      >>> sum(ord(c) for c in "Connection")
      1040
      >>> sum(ord(c) for c in "X-Cnection")
      952
    

I suspect that in this specific scenario the checksum doesn't need to stay the
same, but the packet size does.

------
fatalerrorx3
That is pretty neat, I've noticed this before and like the OP just assumed it
was a typo, nice to see the explanation. No matter how much you think you
know, you don't know everything, that's what makes the IT field so interesting

