Project

General

Profile

Actions

Bug #11671

closed

Net::HTTP uses closed keep-alive connection, causing EOFError

Added by krishan (Kristian Hanekamp) about 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:71421]

Description

Most HTTP servers close idle keep-alive connections after a timeout. For the client, this leads to the TCP socket reaching End-Of-File (EOF). Currently, Net::HTTP does not check for EOF before reusing a keep-alive connection, causing an EOFError.

For idempotent requests (for example GET), this does not do much harm, since Net::HTTP simply retries the request. But this does not work for requests that aren't idempotent like POST, so HTTP#post will raise an unnecessary EOFError.

My suggestion is to check for EOF before reusing a keep-alive connection.

I've prepared a Github PR for this: https://github.com/ruby/ruby/pull/1089

Updated by naruse (Yui NARUSE) almost 6 years ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF