ws: Add support for Chunked Transfer Encoding.

supported for chunked transfer encoding and added/updated related test cases.
fixed some typos and a potential bug.

Fixes #649
Please remove trailing spaces on this line.