]> granicus.if.org Git - apache/commitdiff
mod_proxy_http2 documentation, addition of request notes proxy-status and proxy-sourc...
authorStefan Eissing <icing@apache.org>
Wed, 9 Mar 2016 13:41:16 +0000 (13:41 +0000)
committerStefan Eissing <icing@apache.org>
Wed, 9 Mar 2016 13:41:16 +0000 (13:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1734238 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/mod_proxy_http2.xml [new file with mode: 0644]
modules/http2/h2_proxy_session.c
modules/http2/mod_proxy_http2.c

diff --git a/docs/manual/mod/mod_proxy_http2.xml b/docs/manual/mod/mod_proxy_http2.xml
new file mode 100644 (file)
index 0000000..1a50568
--- /dev/null
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
+<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
+<!-- $LastChangedRevision: 1652400 $ -->
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<modulesynopsis metafile="mod_proxy_http2.xml.meta">
+
+<name>mod_proxy_http2</name>
+<description>HTTP/2 support module for
+<module>mod_proxy</module></description>
+<status>Extension</status>
+<sourcefile>mod_proxy_http2.c</sourcefile>
+<identifier>proxy_http2_module</identifier>
+
+<summary>
+    <p>This module <em>requires</em> the service of <module
+    >mod_proxy</module>. It provides the features used for
+    proxying HTTP/2 requests. <module>mod_proxy_http2</module>
+    supports HTTP/2 only. It does <em>not</em>
+    provide any downgrades to HTTP/1.1.</p>
+
+    <p>Thus, in order to get the ability of handling HTTP/2 proxy requests,
+    <module>mod_proxy</module> and <module>mod_proxy_http2</module>
+    have to be present in the server.</p>
+
+    <p><module>mod_proxy_http2</module> works with incoming requests
+    over HTTP/1.1 and HTTP/2 requests. If <module>mod_proxy_http2</module>
+    handles the frontend connection, requests against the same HTTP/2
+    backend are sent over a single connection, whenever possible.</p>
+
+    <p>This module relies on <a href="http://nghttp2.org/">libnghttp2</a>
+    to provide the core http/2 engine.</p>
+
+    <note type="warning"><title>Warning</title>
+        <p>This module is experimental. Its behaviors, directives, and 
+        defaults are subject to more change from release to 
+        release relative to other standard modules. Users are encouraged to 
+        consult the "CHANGES" file for potential updates.</p>
+    </note>
+
+    <note type="warning"><title>Warning</title>
+      <p>Do not enable proxying until you have <a
+      href="mod_proxy.html#access">secured your server</a>. Open proxy
+      servers are dangerous both to your network and to the Internet at
+      large.</p>
+    </note>
+</summary>
+<seealso><module>mod_http2</module></seealso>
+<seealso><module>mod_proxy</module></seealso>
+<seealso><module>mod_proxy_connect</module></seealso>
+
+<section id="notes"><title>Request notes</title>
+    <p><module>mod_proxy_http</module> creates the following request notes for
+        logging using the <code>%{VARNAME}n</code> format in
+        <directive module="mod_log_config">LogFormat</directive> or
+        <directive module="core">ErrorLogFormat</directive>:
+    </p>
+    <dl>
+        <dt>proxy-source-port</dt>
+        <dd>The local port used for the connection to the backend server.</dd>
+        <dt>proxy-status</dt>
+        <dd>The HTTP/2 status received from the backend server.</dd>
+    </dl>
+</section>
+
+</modulesynopsis>
index 217b36410a03c337314fec6376a6bc21814898c2..307a9ca78ae717c56f4be71b7c829f40be77e1e7 100644 (file)
@@ -225,8 +225,9 @@ static apr_status_t h2_proxy_stream_add_header_out(h2_proxy_stream *stream,
 {
     if (n[0] == ':') {
         if (!stream->data_received && !strncmp(":status", n, nlen)) {
-            char *s = apr_pstrndup(stream->pool, v, vlen);
+            char *s = apr_pstrndup(stream->r->pool, v, vlen);
             
+            apr_table_setn(stream->r->notes, "proxy-status", s);
             ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, stream->session->c, 
                           "h2_proxy_stream(%s-%d): got status %s", 
                           stream->session->id, stream->id, s);
index ab1bb09d2e89588bbc83d3a29982f5333a8c9b6b..dcc6422b946e745c2c71a1ac8113bbae46ce8515 100644 (file)
@@ -226,6 +226,8 @@ static apr_status_t add_request(h2_proxy_session *session, request_rec *r)
     apr_status_t status;
 
     url = apr_table_get(r->notes, H2_PROXY_REQ_URL_NOTE);
+    apr_table_setn(r->notes, "proxy-source-port", apr_psprintf(r->pool, "%hu",
+                   ctx->p_conn->connection->local_addr->port));
     status = h2_proxy_session_submit(session, url, r);
     if (status != OK) {
         ap_log_cerror(APLOG_MARK, APLOG_ERR, status, r->connection, APLOGNO(03351)