ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: naruse@airemix.jp
To: ruby-core@ruby-lang.org
Subject: [ruby-core:72236] [Ruby trunk - Bug #11671] [Closed] Net::HTTP uses closed keep-alive connection, causing EOFError
Date: Fri, 18 Dec 2015 03:50:13 +0000	[thread overview]
Message-ID: <redmine.journal-55644.20151218035012.0033603eb3cb2861@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11671.20151109162659@ruby-lang.org

Issue #11671 has been updated by Yui NARUSE.

Status changed from Open to Closed

----------------------------------------
Bug #11671: Net::HTTP uses closed keep-alive connection, causing EOFError
https://bugs.ruby-lang.org/issues/11671#change-55644

* Author: Kristian Hanekamp
* Status: Closed
* Priority: Normal
* Assignee: Yui NARUSE
* ruby -v: trunk
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
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




-- 
https://bugs.ruby-lang.org/

      parent reply	other threads:[~2015-12-18  3:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-11671.20151109162659@ruby-lang.org>
2015-11-09 16:26 ` [ruby-core:71421] [Ruby trunk - Bug #11671] [Open] Net::HTTP uses closed keep-alive connection, causing EOFError kris.hanekamp
2015-12-18  3:50 ` naruse [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-55644.20151218035012.0033603eb3cb2861@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).