Fix encoding inconsistencies with OpenSSL::SSL::SSLSocket #106

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
4 participants
Contributor

zenchild commented Jul 26, 2012

There is some inconsistent encoding behavior that I have tried to fix here. In particular OpenSSL::SSL::SSLSocket returns strings with different encoding types at times and can lead to an impedance mismatch of sorts. For instance if a body contains something like so:

<ul>
<li> • Test one
<li> • Test two
</ul>

The bullet is an encoded character and lets say the body is chunked between the "li" elements. If the first part is encoded as ASCII_8BIT and the second part is encoded as US_ASCII it will raise an exception (Encoding::CompatibilityError) in HTTPClient#do_get_block where we concatenate the content:

content << part

Hiroshi Nakamura » httpclient #15 FAILURE
Looks like there's a problem with this pull request
(what's this?)

Hiroshi Nakamura » httpclient #16 FAILURE
Looks like there's a problem with this pull request
(what's this?)

Contributor

zenchild commented Jul 26, 2012

Wow, I guess it's been awhile since I've used ruby 1.8. I'll clean things up and push it out.

@zenchild zenchild Fix encoding inconsistencies with OpenSSL::SSL::SSLSocket
Fix encoding mismatch between content and parts
6169b67

Hiroshi Nakamura » httpclient #17 SUCCESS
This pull request looks good
(what's this?)

Nice work

Owner

nahi commented Aug 11, 2012

Thanks @buildhive, a guardian for ruby 1.8 support. :)

@zenchild, what version of ruby are you using? I'm not quite sure but we fix openssl encoding issue in 1.9.3. Does this problem still happens on 1.9.3?

And I don't think it passes tests because it tries nil.force_encoding(...) when block is given...

Contributor

zenchild commented Aug 11, 2012

@nahi we're using 1.9.2 so I'll give it a shot with 1.9.3 and see if that fixes it up. If not, I'll fix the nil.force_encoding(...) and update the pull request. Thanks for your comments.

Cheers,

Dan

Hiroshi Nakamura » httpclient #54 SUCCESS
This pull request looks good
(what's this?)

@nahi nahi added ThirdPartyIssue and removed Feedback labels Nov 3, 2014

Owner

nahi commented Nov 3, 2014

Since 1.9.2 is dead I close this ticket but it's still helpful for 1.9.2 users.

nahi closed this Nov 3, 2014

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