On 07/24/2015 02:09 PM, ic...@apache.org wrote: > Author: icing > Date: Fri Jul 24 12:09:44 2015 > New Revision: 1692486 > > URL: http://svn.apache.org/r1692486 > Log: > new Protocols directive and core API changes to enable protocol switching on > HTTP Upgrade or ALPN, implemented in mod_ssl and mod_h2 > > Added: > httpd/httpd/trunk/modules/http2/h2_switch.c > - copied, changed from r1692482, > httpd/httpd/trunk/modules/http2/h2_alpn.c > httpd/httpd/trunk/modules/http2/h2_switch.h > - copied, changed from r1692482, > httpd/httpd/trunk/modules/http2/h2_alpn.h > Removed: > httpd/httpd/trunk/modules/http2/h2_alpn.c > httpd/httpd/trunk/modules/http2/h2_alpn.h > httpd/httpd/trunk/modules/http2/h2_upgrade.c > httpd/httpd/trunk/modules/http2/h2_upgrade.h > Modified: > httpd/httpd/trunk/docs/log-message-tags/next-number > httpd/httpd/trunk/include/http_core.h > httpd/httpd/trunk/include/http_protocol.h > httpd/httpd/trunk/modules/http2/config.m4 > httpd/httpd/trunk/modules/http2/h2_conn.c > httpd/httpd/trunk/modules/http2/h2_ctx.c > httpd/httpd/trunk/modules/http2/h2_ctx.h > httpd/httpd/trunk/modules/http2/h2_from_h1.c > httpd/httpd/trunk/modules/http2/h2_h2.c > httpd/httpd/trunk/modules/http2/h2_h2.h > httpd/httpd/trunk/modules/http2/h2_mplx.c > httpd/httpd/trunk/modules/http2/h2_request.c > httpd/httpd/trunk/modules/http2/h2_response.c > httpd/httpd/trunk/modules/http2/h2_session.c > httpd/httpd/trunk/modules/http2/h2_task.c > httpd/httpd/trunk/modules/http2/h2_task_input.c > httpd/httpd/trunk/modules/http2/h2_to_h1.c > httpd/httpd/trunk/modules/http2/h2_util.c > httpd/httpd/trunk/modules/http2/h2_util.h > httpd/httpd/trunk/modules/http2/h2_version.h > httpd/httpd/trunk/modules/http2/h2_worker.c > httpd/httpd/trunk/modules/http2/h2_workers.c > httpd/httpd/trunk/modules/http2/mod_h2.c > httpd/httpd/trunk/modules/http2/mod_h2.h > httpd/httpd/trunk/modules/ssl/mod_ssl.c > httpd/httpd/trunk/modules/ssl/mod_ssl.h > httpd/httpd/trunk/modules/ssl/ssl_engine_config.c > httpd/httpd/trunk/modules/ssl/ssl_engine_io.c > httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c > httpd/httpd/trunk/modules/ssl/ssl_private.h > httpd/httpd/trunk/server/core.c > httpd/httpd/trunk/server/protocol.c >
> Modified: httpd/httpd/trunk/include/http_protocol.h > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_protocol.h?rev=1692486&r1=1692485&r2=1692486&view=diff > ============================================================================== > --- httpd/httpd/trunk/include/http_protocol.h (original) > +++ httpd/httpd/trunk/include/http_protocol.h Fri Jul 24 12:09:44 2015 > @@ -700,6 +700,109 @@ AP_DECLARE_HOOK(const char *,http_scheme > */ > AP_DECLARE_HOOK(apr_port_t,default_port,(const request_rec *r)) > > + > +#define AP_PROTOCOL_HTTP1 "http/1.1" > + > +/** > + * Negotiate a possible protocol switch on the connection. The negotiation > + * may start without any request sent, in which case the request is NULL. Or > + * it may be triggered by the request received, e.g. through the "Upgrade" > + * header. > + * > + * The identifiers for protocols are taken from the TLS extension type ALPN: > + * > https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xml > + * > + * If no protocols are added to the proposals, the server will always > fallback > + * to "http/1.1" which is the default protocol for connections that Apache > + * handles. If the protocol selected from the proposals is the protocol > + * already in place, no "protocol_switch" will be invoked. > + * > + * All hooks are run, unless one returns an error. Proposals may contain > + * duplicates. The order in which proposals are added is usually ignored. > + * > + * @param c The current connection > + * @param r The current request or NULL > + * @param s The server/virtual host selected > + * @param offers a list of protocol identifiers offered by the client > + * @param proposals the list of protocol identifiers proposed by the hooks > + * @return OK or DECLINED > + */ > +AP_DECLARE_HOOK(int,protocol_propose,(conn_rec *c, request_rec *r, > + server_rec *s, > + const apr_array_header_t *offers, > + apr_array_header_t *proposals)) > + > +/** > + * Perform a protocol switch on the connection. The exact requirements for > + * that depend on the protocol in place and the one switched to. The first > + * protocol module to handle the switch is the last module run. > + * > + * For a connection level switch (r == NULL), the handler must on return > + * leave the conn_rec in a state suitable for processing the switched > + * protocol, e.g. correct filters in place. > + * > + * For a request triggered switch (r != NULL), the protocol switch is done > + * before the response is sent out. When switching from "http/1.1" via > Upgrade > + * header, the 101 intermediate response will have been sent. The > + * hook needs then to process the connection until it can be closed. Which > + * the server will enforce on hook return. > + * Any error the hook might encounter must already be sent by the hook itself > + * to the client in whatever form the new protocol requires. > + * > + * @param c The current connection > + * @param r The current request or NULL > + * @param s The server/virtual host selected > + * @param choices a list of protocol identifiers, normally the clients > whishes > + * @param proposals the list of protocol identifiers proposed by the hooks > + * @return OK or DECLINED I guess we have a copy and paste error here for the parameter documentation of the hook below. > + */ > +AP_DECLARE_HOOK(int,protocol_switch,(conn_rec *c, request_rec *r, > + server_rec *s, > + const char *protocol)) > + Regards RĂ¼diger