-
Notifications
You must be signed in to change notification settings - Fork 289
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
base: master
Are you sure you want to change the base?
Conversation
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? |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In build_request_signature
, I seem that a file pointer is not reset.
Error occured when FILE IO's postion is END.
I don't want to error as possible.