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

Response is being truncated when it includes multibyte chars #320

Closed
ryan-plated opened this issue Jul 2, 2018 · 5 comments
Closed

Response is being truncated when it includes multibyte chars #320

ryan-plated opened this issue Jul 2, 2018 · 5 comments

Comments

@ryan-plated
Copy link

it appears bytesize returns the wrong length

head['content-length'] = body.bytesize

oesmith/puffing-billy#233

@igrigorik
Copy link
Owner

Thanks for reporting this. Do you have an example where this fails for em-http? The thread you linked to talks about Chrome receiving the response.. it's unclear to where if/where em-http is involved there.

@nicedawg
Copy link

nicedawg commented Jul 24, 2018

I found this reported issue while looking into oesmith/puffing-billy#193 -- specifically the problem the described in this comment, and the subsequent discussion.

My primitive understanding of the puffing-billy code is that it makes a request (acting as a proxy on behalf of a browser like chrome), ultimately using EventMachine::HttpRequest to send the request and getting the response from EventMachine::HttpClient. (I could be misunderstanding it, though.)

In this comment somebody created a simple reproduction of the issue I'm interested in.

Of course, this may not help with oesmith/puffing-billy#233, but I hope it at least sheds (correct) light on how puffing-billy uses em-http-request.

@igrigorik
Copy link
Owner

@nicedawg hmm, thanks for the link. On first pass, I don't think these two issues are related. It's also not clear to me if em-http is the culprit in that thread, but that's a different discussion.

@ryan-plated per your earlier comment...

require 'json'

hash = { localidade: 'Niterói', bairro: 'Icaraí' }
json = JSON.generate(hash)

puts json
puts json.bytesize

ruby test.rb
{"localidade":"Niterói","bairro":"Icaraí"}
44

That looks correct to me. Assuming the payload is not being converted to some other encoding before it's passed to em-http, bytesize should do return the right value?

@hawkins
Copy link

hawkins commented Jan 15, 2019

The original puffing-billy issue which sparked this issue has since been closed with a workaround that doesn't even point to a change in this repo. Is there still an underlying issue with EM HTTP and multibyte character codes?

@ryan-plated
Copy link
Author

I think it is fine to close the comment now. I haven't run in to it recently, Thanks for following up.

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

No branches or pull requests

4 participants