LearnBoost/socket.io — pull request #922 by sebv (2012-06-16 10:40:07+00:00)
Title: fix to prevent data corruption when using xhr with chunked data

fixes #921

In the handleRequest method the data is of type Buffer (not string), and gets corrupted when the data is split in several parts.

this replicates the data corruption:

```coffeescript
message = '一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一'

# splitting data
buf = new Buffer(message, 'utf8')

byteLength = buf.length

datas = [
buf[0...31]
buf[31...61]
buf[61...]
]

# adding data to string

buf =''
for data in datas
buf = buf + data

console.log "1->", buf # data corruption

# using buffer

buf = new Buffer byteLength

curPos = 0
for data in datas
_buf = new Buffer data
_buf.copy buf, curPos
curPos = curPos + data.length

console.log "2->", buf.toString() # data OK
```

I wanted to write a test case, but not sure how to send chunked data via the test client. If someone
could give me a hint on that.