Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return response body chunks in specified encoding #414

Merged

Conversation

janko
Copy link
Member

@janko janko commented May 24, 2017

MRI will return content read from the socket in the ASCII-8BIT (binary) encoding, whereas JRuby will return it in the UTF-8 encoding. In whichever encoding the body is retrieved, we want to force its encoding to the one specified (charset response header if present, otherwise binary). This is already the behaviour in Response::Body#to_s, we just extend it to Response::Body#readpartial as well.

Fixes #413.

@janko janko force-pushed the return-response-body-chunks-in-specified-encoding branch from 51a87be to a6bc27f Compare May 24, 2017 04:29
MRI will return content read from the socket in the ASCII-8BIT (binary)
encoding, whereas JRuby will return it in the UTF-8 encoding. In
whichever encoding the body is retrieved, we want to force its encoding
to the one specified (charset response header if present, otherwise
binary). This is already the behaviour in Response#to_s, we just extend
it to Response#readpartial as well.

Fixes httprb#413
@janko janko force-pushed the return-response-body-chunks-in-specified-encoding branch from a6bc27f to e3efe86 Compare May 24, 2017 06:07
@ixti ixti self-assigned this May 24, 2017
@ixti ixti merged commit 02bd825 into httprb:master May 29, 2017
@ixti
Copy link
Member

ixti commented May 29, 2017

Thanks!

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Dec 9, 2017
pkgsrc changes:
- sort DEPENDS

Upstream changes (from CHANGES.md):

## 3.0.0 (2017-10-01)

* Drop support of Ruby `2.0` and Ruby `2.1`.
  ([@ixti])

* [#410](httprb/http#410)
  Infer `Host` header upon redirects.
  ([@janko-m])

* [#409](httprb/http#409)
  Enables request body streaming on any IO object.
  ([@janko-m])

* [#413](httprb/http#413),
  [#414](httprb/http#414)
  Fix encoding of body chunks.
  ([@janko-m])

* [#368](httprb/http#368),
  [#357](httprb/http#357)
  Fix timeout issue.
  ([@HoneyryderChuck])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants