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

Faraday patches #90

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -2,3 +2,5 @@
tags
pkg
coverage
reports
Gemfile.lock
8 changes: 3 additions & 5 deletions lib/httpclient/http.rb
Expand Up @@ -549,23 +549,21 @@ def set_content(body, boundary = nil)

def remember_pos(io)
# IO may not support it (ex. IO.pipe)
@positions[io] = io.pos rescue nil
@positions[io] = io.pos if io.respond_to?(:pos)
end

def reset_pos(io)
io.pos = @positions[io] if @positions.key?(io)
end

def dump_file(io, dev)
buf = ''
while !io.read(@chunk_size, buf).nil?
while buf = io.read(@chunk_size)
dev << buf
end
end

def dump_chunks(io, dev)
buf = ''
while !io.read(@chunk_size, buf).nil?
while buf = io.read(@chunk_size)
dev << dump_chunk(buf)
end
end
Expand Down