# File lib/rfuzz/pushbackio.rb, line 40
40:     def read(n, partial=false)
41:       r = pop(n)
42:       needs = n - r.length
43: 
44:       if needs > 0
45:         sec = ""
46:         if partial
47:           begin
48:             protect do
49:               sec = @secondary.readpartial(needs) 
50:             end
51:           rescue EOFError
52:             # TODO: notify closed? error?
53:           end
54:         else
55:           protect { sec = @secondary.read(needs)}
56:         end
57: 
58:         r << (sec || "")
59: 
60:         # finally, if there's nothing at all returned then this is bad
61:         if r.length == 0
62:           raise HttpClientError.new("Server returned empty response.")
63:         end
64:       end
65: 
66:       reset
67:       return r
68:     end