Photo-1 Photo-2 Photo-3 Photo-4 Photo-5 Photo-6

@brentmc79

@brentmc79

Full-time web developer. Part-time smart ass.

I'm Brent Collier.

After a year and a half as an engineer on Twitter's Trust & Safety team, I'm looking for my next gig. Contact me if you know of something interesting.

#

Net::HTTP "End of file reached"

Posted on 03/25/2013

While writing some code to consume Twitter's v1.1 api, I was continually running into this error:

EOFError: end of file reached

I began adding and removing bits of code around the http request, until I eventually discovered it was the gzip encoding that was causing the problem. Removing this header declaration seemed to fix everything up:

request["Accept-Encoding"] = "gzip"

Update

I ran into the same issue again, this time with a different solution. I was including an HMAC signature in the header, but wasn't encoding it properly.

I changed it from

request['X-Hmac-signature"] = generate_signature

to

request['X-Hmac-signature'] = URI.encode(generate_signature)

and the EOFerror went away.