Skip to content

retry in streaming response causes corrupt downloads #86

Closed
@jstanley0

Description

@jstanley0

If a socket error occurs while performing a streaming download via the response block provided to transport_request, a retry may cause the response block may be invoked a second time.

For code patterns like this one:

  open('some_file', 'wb') do |io|
    http.request(...) do |response|
      response.read_body do |chunk|
        io.write chunk
      end
    end
  end

The output file will be corrupted since some portion of its data near the beginning will be duplicated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions