Added a fix and modified the unit tests to accomodate. #85

Merged
merged 1 commit into from Mar 29, 2013

Conversation

Projects
None yet
3 participants
@RishiRamraj
Contributor

RishiRamraj commented Nov 22, 2012

The bug report can be found here:

#84

SSL v3 (wrap_socket) blows up if the WSGI iterator yields an empty byte string. The compress function will buffer input if there isn't enough and return an empty byte string. As a result, the wrap_socket function of the ssl module will raise the following exception:

ssl.SSLError: EOF occurred in violation of protocol as a result of zlib compression.
@twillis

This comment has been minimized.

Show comment Hide comment
@twillis

twillis Mar 18, 2013

Contributor

thanks for the pull request @RishiRamraj . one question, can you elaborate on when this condition occurs. or whip up a test demonstrating it? the pull request looks fine but one line doesn't get coverage and I'm hesitant to bring it in without full test coverage or a really convincing reason as to why it would not need test coverage.

Contributor

twillis commented Mar 18, 2013

thanks for the pull request @RishiRamraj . one question, can you elaborate on when this condition occurs. or whip up a test demonstrating it? the pull request looks fine but one line doesn't get coverage and I'm hesitant to bring it in without full test coverage or a really convincing reason as to why it would not need test coverage.

@RishiRamraj

This comment has been minimized.

Show comment Hide comment
@RishiRamraj

RishiRamraj Mar 18, 2013

Contributor

@twillis Thanks for the library :) Let me see if I can add more coverage. Here's an end to end test: http://bpaste.net/show/rZetpdSurhKyggVccl1r/

Contributor

RishiRamraj commented Mar 18, 2013

@twillis Thanks for the library :) Let me see if I can add more coverage. Here's an end to end test: http://bpaste.net/show/rZetpdSurhKyggVccl1r/

@RishiRamraj

This comment has been minimized.

Show comment Hide comment
@RishiRamraj

RishiRamraj Mar 19, 2013

Contributor

I did some digging. I've traced down the size of zlib's compression buffer to this line in zlib, in the deflate.c file:

s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);

You can trigger the untested line by trying to encode at least 100k bytes. Unfortunately, the only way I can think of to test this line, short of using the mock module, is to try and compress this much data and check the result. Any ideas?

Contributor

RishiRamraj commented Mar 19, 2013

I did some digging. I've traced down the size of zlib's compression buffer to this line in zlib, in the deflate.c file:

s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);

You can trigger the untested line by trying to encode at least 100k bytes. Unfortunately, the only way I can think of to test this line, short of using the mock module, is to try and compress this much data and check the result. Any ideas?

@twillis

This comment has been minimized.

Show comment Hide comment
@twillis

twillis Mar 19, 2013

Contributor

@RishiRamraj thanks for digging into it. I think thats enough info for me to figure it out.

Contributor

twillis commented Mar 19, 2013

@RishiRamraj thanks for digging into it. I think thats enough info for me to figure it out.

@twillis

This comment has been minimized.

Show comment Hide comment
@twillis

twillis Mar 19, 2013

Contributor

test coverage here. should be good to merge now

#97

Contributor

twillis commented Mar 19, 2013

test coverage here. should be good to merge now

#97

@twillis

This comment has been minimized.

Show comment Hide comment
@twillis

twillis Mar 23, 2013

Contributor

#98

Contributor

twillis commented Mar 23, 2013

#98

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment