Commit Graph

9 Commits

Author SHA1 Message Date
Janko Marohnić e20e6bdffd Allow download destination to only respond to #write (#638)
According to the documentation the destination IO only needs to respond
to #write. However, the downloader breaks this by calling #flush.

We fix this by calling #flush only if the destination IO responds to
that method. We also add a test to enforce that the destination IO only
needs to respond to #write.
2018-12-04 13:09:11 -08:00
Janko Marohnić 0eeb3ee9f9 Recover from non-Ranged responses without rewinding
Not all IO objects know how to #rewind themselves. For example, Ruby
pipes (returned by `IO.pipe`) do implement #rewind, but they will throw
an error if you try to call it.

  rd, wr = IO.pipe
  wr.rewind # Errno::ESPIPE: Illegal seek

But we don't need to rewind and overwrite the IO object if we didn't get
the Ranged response we expected, we could instead wait out the content
that has already been downloaded, and start appending again once we
reached where we left off. This is what this commit does.
2017-06-23 11:22:37 +02:00
Steve Bazyl 4682267161 Move timeouts from request to clientoptions, update migration/changelog 2017-04-03 11:10:54 -07:00
Steve Bazyl c4d0ed5d3c Merge branch 'master' into v0.10 2017-03-29 16:25:34 -07:00
Steve Bazyl a68b8cb758 #467 - Restore error handling for failed downloads 2016-09-19 14:16:36 -07:00
Steve Bazyl 2046e00f14 Remove Hurley as a dependency 2016-08-17 13:51:09 -07:00
Steve Bazyl 0155b81771 Rewind output stream if requesting partial content but get the full media body instead 2016-04-22 14:30:30 -07:00
Steve Bazyl a1b5f6c2d2 Issue #290 - Fix redirects during downloads, only stream body content on 20x response. Includes temporary patch to Hurley until 0.3 released 2015-12-02 15:52:30 -08:00
Steven Bazyl f584a2cec8 Import refactored library. See MIGRATING.MD for details 2015-06-23 15:15:14 -07:00