You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2016/11/23 16:14:07 UTC
svn commit: r1770998 - in /httpd/httpd/trunk:
docs/log-message-tags/next-number modules/http2/h2_proxy_session.c
modules/http2/h2_proxy_session.h modules/http2/mod_proxy_http2.c
Author: icing
Date: Wed Nov 23 16:14:06 2016
New Revision: 1770998
URL: http://svn.apache.org/viewvc?rev=1770998&view=rev
Log:
mod_proxy_http2: not forwarding any 1xx responses on frontend HTTP/1.x connections. Unless its 100 and the client is expecting that.
Modified:
httpd/httpd/trunk/docs/log-message-tags/next-number
httpd/httpd/trunk/modules/http2/h2_proxy_session.c
httpd/httpd/trunk/modules/http2/h2_proxy_session.h
httpd/httpd/trunk/modules/http2/mod_proxy_http2.c
Modified: httpd/httpd/trunk/docs/log-message-tags/next-number
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/log-message-tags/next-number?rev=1770998&r1=1770997&r2=1770998&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/log-message-tags/next-number (original)
+++ httpd/httpd/trunk/docs/log-message-tags/next-number Wed Nov 23 16:14:06 2016
@@ -1 +1 @@
-3486
+3488
Modified: httpd/httpd/trunk/modules/http2/h2_proxy_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_proxy_session.c?rev=1770998&r1=1770997&r2=1770998&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_proxy_session.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_proxy_session.c Wed Nov 23 16:14:06 2016
@@ -160,10 +160,17 @@ static int on_frame_recv(nghttp2_session
}
r = stream->r;
if (r->status >= 100 && r->status < 200) {
- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "h2_proxy_session(%s): got interim HEADERS, status=%d",
- session->id, r->status);
+ /* By default, we will forward all interim responses when
+ * we are sitting on a HTTP/2 connection to the client */
+ int forward = session->h2_front;
switch(r->status) {
+ case 100:
+ if (stream->waiting_on_100) {
+ stream->waiting_on_100 = 0;
+ r->status_line = ap_get_status_line(r->status);
+ forward = 1;
+ }
+ break;
case 103:
/* workaround until we get this into http protocol base
* parts. without this, unknown codes are converted to
@@ -174,9 +181,14 @@ static int on_frame_recv(nghttp2_session
r->status_line = ap_get_status_line(r->status);
break;
}
- ap_send_interim_response(r, 1);
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03487)
+ "h2_proxy_session(%s): got interim HEADERS, "
+ "status=%d, will forward=%d",
+ session->id, r->status, forward);
+ if (forward) {
+ ap_send_interim_response(r, 1);
+ }
}
- stream->waiting_on_100 = 0;
stream_resume(stream);
break;
case NGHTTP2_PING:
@@ -582,6 +594,7 @@ static int on_invalid_header_cb(nghttp2_
h2_proxy_session *h2_proxy_session_setup(const char *id, proxy_conn_rec *p_conn,
proxy_server_conf *conf,
+ int h2_front,
unsigned char window_bits_connection,
unsigned char window_bits_stream,
h2_proxy_request_done *done)
@@ -602,6 +615,7 @@ h2_proxy_session *h2_proxy_session_setup
session->conf = conf;
session->pool = p_conn->scpool;
session->state = H2_PROXYS_ST_INIT;
+ session->h2_front = h2_front;
session->window_bits_stream = window_bits_stream;
session->window_bits_connection = window_bits_connection;
session->streams = h2_proxy_ihash_create(pool, offsetof(h2_proxy_stream, id));
Modified: httpd/httpd/trunk/modules/http2/h2_proxy_session.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_proxy_session.h?rev=1770998&r1=1770997&r2=1770998&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_proxy_session.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_proxy_session.h Wed Nov 23 16:14:06 2016
@@ -64,6 +64,7 @@ struct h2_proxy_session {
unsigned int aborted : 1;
unsigned int check_ping : 1;
+ unsigned int h2_front : 1; /* if front-end connection is HTTP/2 */
h2_proxy_request_done *done;
void *user_data;
@@ -86,6 +87,7 @@ struct h2_proxy_session {
h2_proxy_session *h2_proxy_session_setup(const char *id, proxy_conn_rec *p_conn,
proxy_server_conf *conf,
+ int h2_front,
unsigned char window_bits_connection,
unsigned char window_bits_stream,
h2_proxy_request_done *done);
Modified: httpd/httpd/trunk/modules/http2/mod_proxy_http2.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/mod_proxy_http2.c?rev=1770998&r1=1770997&r2=1770998&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/mod_proxy_http2.c (original)
+++ httpd/httpd/trunk/modules/http2/mod_proxy_http2.c Wed Nov 23 16:14:06 2016
@@ -335,14 +335,17 @@ static apr_status_t next_request(h2_prox
static apr_status_t proxy_engine_run(h2_proxy_ctx *ctx) {
apr_status_t status = OK;
+ int h2_front;
/* Step Four: Send the Request in a new HTTP/2 stream and
* loop until we got the response or encounter errors.
*/
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, ctx->owner,
"eng(%s): setup session", ctx->engine_id);
- ctx->session = h2_proxy_session_setup(ctx->engine_id, ctx->p_conn, ctx->conf,
- 30, h2_proxy_log2((int)ctx->req_buffer_size),
+ h2_front = is_h2? is_h2(ctx->owner) : 0;
+ ctx->session = h2_proxy_session_setup(ctx->engine_id, ctx->p_conn, ctx->conf,
+ h2_front, 30,
+ h2_proxy_log2((int)ctx->req_buffer_size),
request_done);
if (!ctx->session) {
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, ctx->owner,