﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
816	Allow h2c and HTTP/1.1 support on the same listening socket	LPardue@…		"nginx 1.9.5 introduces support for HTTP/2.

If a user configures a h2c listening socket (e.g. {{{listen port_num http2}}}) only HTTP/2 connections via prior knowledge can be created; HTTP/1.1 clients will fail on the socket, preventing the use of HTTP Upgrade as a means of negotiating the protocol. In contrast, a h2 listening socket supports both HTTP/1.1 and HTTP/2 with negotiation of protocol via ALPN.

This ticket request an enhancement to allow simultaneous support of HTTP/1.1 and HTTP/2 on a plain TCP socket when using {{{http2}}}. Without the feature, we require the multiple listening ports for different protocols, which must be identified and managed out-of-band. The HTTP/2 spec accommodates support for multiple protocols on the same port. This enhancement could be achieved by implementing the following features (defined in [https://tools.ietf.org/html/rfc7540#section-3.2 section 3.2]) :

* Selection of protocol version by inspection of the request line
  * If the request line matches the HTTP/2 [https://tools.ietf.org/html/rfc7540#section-3.5 client connection preface] then select HTTP/2 as the protocol for remainder of connection
  * else assume HTTP/1.1 for the remainder of connection. Standard request line validation rules are still applied. Note that if upgrade mechanism (below) is not implemented then ignore the request and just select HTTP/1.1.
* Selection of protocol version using the HTTP Upgrade mechanism
  * If the client issues a valid h2c upgrade request
    * If the server supports h2c, respond with HTTP/1.1 101 Switching Protocols response and then select HTTP/2 as the protocol for remainder of connection
    * If the server does not support h2c, select the HTTP/1.1 protocol for remainder of connection and respond accordingly
  * If client issues an invalid upgrade request (e.g. {{{h2}}}) then ignore and select HTTP/1.1 protocol

For reference, this enhancement request tracks back to #808."	enhancement	closed	minor		nginx-core	1.9.x	fixed				1.9.5
