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

Don't eagerly write response body in case of redirect #1168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/clientlayers/StreamRequest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ end

function readbody!(stream::Stream, res::Response, buf_or_stream, lock)
n = 0
if !iserror(res)
if !iserror(res) && !isredirect(res)
Copy link
Member

@fredrikekre fredrikekre Apr 14, 2024

Choose a reason for hiding this comment

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

I don't think this is sufficient, you also need to check if this redirect is to be followed or not (redirect::Bool and redirect_limit::Int arguments).

This case doesn't seem to be tested either since HTTP.get("http://localhost:8123"; redirect=false, response_stream = stderr); from the issue description gives no body at all with this PR.

if isbytes(res.body)
if length(res.body) > 0
# user-provided buffer to read response body into
Expand Down
Loading