# File lib/rfuzz/pushbackio.rb, line 51 51: def read(n, partial=false) 52: random_death 53: r = pop(n) 54: needs = n - r.length 55: 56: if needs > 0 57: sec = "" 58: if partial 59: begin 60: protect do 61: sec = @secondary.readpartial(needs) 62: end 63: rescue EOFError 64: close 65: end 66: else 67: protect { sec = @secondary.read(needs)} 68: end 69: 70: r << (sec || "") 71: 72: # finally, if there's nothing at all returned then this is bad 73: if r.length == 0 74: raise HttpClientError.new("Server returned empty response.") 75: end 76: end 77: 78: reset 79: return r 80: end