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

Fix reading body failing with nil error #60

Merged
merged 1 commit into from
Sep 1, 2023

Conversation

mshibuya
Copy link
Contributor

This PR aims to fix the issue #58, which was caused by #51.

@arkadiyt Please review this, many users are facing this issue.
carrierwaveuploader/carrierwave#2628

return nil, url
else
block&.call(response)
return response, nil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This use of using return within a block is the cause of the issue. It causes the execution to jump out from the method #fetch_once (not from this block), skipping post-processing of body read by net-http. So the result is attempting to read the body afterwards, when @socket already cleared up with nil.

@niborg
Copy link

niborg commented Dec 2, 2022

@arkadiyt any input on this?

@zumkorn
Copy link

zumkorn commented Dec 15, 2022

@arkadiyt can you check this, please?

@basex
Copy link

basex commented Dec 29, 2022

@arkadiyt if you have some time, merge please this MR and release a new version. It's needed for projects with ruby 3.2

Versions previous to 1.1.1 won't work in ruby 3.2. #54 fixed the problem.
Version 1.1.1 doesn't work well due to the issue #58. This MR fixes the issue.

@arkadiyt arkadiyt merged commit 6710ecc into arkadiyt:main Sep 1, 2023
@arkadiyt
Copy link
Owner

arkadiyt commented Sep 1, 2023

Sorry on the very long delay here, I'm getting back to this gem and going to maintain it more actively. Appreciate the fix

@mshibuya mshibuya deleted the fix-body-read-failure branch September 3, 2023 10:20
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.

6 participants