From 60f207111d17df04dfeca3f4a01e386de1fb0046 Mon Sep 17 00:00:00 2001 From: bel Date: Fri, 26 Feb 2016 23:32:35 +0100 Subject: [PATCH] Don't call local request handler for requests with absolute URIs of other servers (#266) --- src/civetweb.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/civetweb.c b/src/civetweb.c index 36839bd8..88afe95d 100644 --- a/src/civetweb.c +++ b/src/civetweb.c @@ -11796,11 +11796,18 @@ process_new_connection(struct mg_connection *conn) } if (ebuf[0] == '\0') { - handle_request(conn); - if (conn->ctx->callbacks.end_request != NULL) { - conn->ctx->callbacks.end_request(conn, conn->status_code); + if (conn->request_info.local_uri) { + /* handle request to local server */ + handle_request(conn); + if (conn->ctx->callbacks.end_request != NULL) { + conn->ctx->callbacks.end_request(conn, + conn->status_code); + } + log_access(conn); + } else { + /* TODO: handle non-local request (PROXY) */ + conn->must_close = 1; } - log_access(conn); } else { conn->must_close = 1; }