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 when file io is EOF #311

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nakajijapan
Copy link

Error occured when FILE IO's postion is END.
I don't want to error as possible.

buf = ''
rest = sz
while rest > 0
n = io.read([rest, @chunk_size].min, buf)
raise ArgumentError.new("Illegal size value: #size returns #{sz} but cannot read") if n.nil?
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to error this?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's intentional to detect the situation where "it should be able to read XX bytes but httpclient can read only <XX bytes". I didn't want to ignore this unexpected situation.
How does sz become unexpected number in your case?

Copy link
Author

@nakajijapan nakajijapan Jun 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This phenomenon occurred when I was testing with webmock.

I seem that the same proccessing is performed twice in a testing.

Maybe, around here file.
https://github.com/bblimke/webmock/blob/master/lib/webmock/http_lib_adapters/httpclient_adapter.rb

I think that there may be a problem with the webmock side possibly. I try to search.

Thanks.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nahi nahi added the Feedback label Jun 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants