From: duerst@... Date: 2016-11-04T21:23:23+00:00 Subject: [ruby-core:77933] [Ruby trunk Bug#12890] Net::HTTP should treat unexpected 1XX responses as non-final. Issue #12890 has been updated by Martin D��rst. A testing endpoint is available at https://nghttp2.org/?103-eh (see https://lists.w3.org/Archives/Public/ietf-http-wg/2016OctDec/0408.html). ---------------------------------------- Bug #12890: Net::HTTP should treat unexpected 1XX responses as non-final. https://bugs.ruby-lang.org/issues/12890#change-61252 * Author: Cory Benfield * Status: Open * Priority: Normal * Assignee: * ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- Long story short Net::HTTP's client does not tolerate non-100 status codes from the 1XX block in a sensible manner: it treats them as final responses, rather than as provisional ones. Expected behaviour When Net::HTTP receives a 1XX status code that it does not recognise, it should either surface these to a user in such a way that allows the user to access the subsequent final response, or it should ignore them and only show the user the eventual final status code. This is required by RFC 7231 Section 6.2 (Informational 1xx), which reads: > A client MUST be able to parse one or more 1xx responses received prior to a final response, even if the client does not expect one. A user agent MAY ignore unexpected 1xx responses. Actual behaviour Net::HTTP treats the 1XX status code as final. It parses the header block as though it were a response in the 2XX or higher range. Net::HTTP rightly assumes that 1XX responses have no body, which means that it leaves the following 2XX response unconsumed in the socket buffer, which will hide critical data from the user. Steps to reproduce The following Python "server" can demonstrate the issue: ~~~ python import socket import time document = b'''