[Bug fix] Do zero check on the value to be a denominator in incoming DEFLATE ratio calculation.

Release note: same as CL title
Review URL: https://codereview.appspot.com/8408043

git-svn-id: http://pywebsocket.googlecode.com/svn/trunk@746 4ff78f4a-9131-11de-b045-6380ec9940d4
Make window bits parameter validation stricter.

Unittests are also added.

Release note: LZ77 window bits related extension parameter with leading zeroes will be rejected.
Review URL: https://codereview.appspot.com/8347044

git-svn-id: http://pywebsocket.googlecode.com/svn/trunk@747 4ff78f4a-9131-11de-b045-6380ec9940d4
Factor out part of compression stats calculation code into a separate class.

Release note: n/a (no behavior change)
Review URL: https://codereview.appspot.com/8411043

git-svn-id: http://pywebsocket.googlecode.com/svn/trunk@748 4ff78f4a-9131-11de-b045-6380ec9940d4