Return-Path: X-Original-To: apmail-httpd-dev-archive@www.apache.org Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AC1B018699 for ; Fri, 24 Jul 2015 13:54:21 +0000 (UTC) Received: (qmail 66009 invoked by uid 500); 24 Jul 2015 13:54:21 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 65937 invoked by uid 500); 24 Jul 2015 13:54:21 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 65928 invoked by uid 99); 24 Jul 2015 13:54:21 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2015 13:54:21 +0000 Received: from gauss.localdomain (v4-861342cd.pool.vitroconnect.de [134.19.66.205]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id C07751A01A6 for ; Fri, 24 Jul 2015 13:54:20 +0000 (UTC) Received: from [IPv6:::1] (localhost [IPv6:::1]) by gauss.localdomain (Postfix) with ESMTP id A192D57A for ; Fri, 24 Jul 2015 15:54:19 +0200 (CEST) Message-ID: <55B2438B.8040701@apache.org> Date: Fri, 24 Jul 2015 15:54:19 +0200 From: Ruediger Pluem User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33.1 MIME-Version: 1.0 To: dev@httpd.apache.org Subject: Re: svn commit: r1692486 [1/2] - in /httpd/httpd/trunk: docs/log-message-tags/ include/ modules/http2/ modules/ssl/ server/ References: <20150724120946.26BD4AC0623@hades.apache.org> <55B2406A.2090606@apache.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 07/24/2015 03:50 PM, Stefan Eissing wrote: > >> Am 24.07.2015 um 15:40 schrieb Ruediger Pluem : >> >> >> >> On 07/24/2015 02:09 PM, icing@apache.org wrote: >>> Author: icing >>> Date: Fri Jul 24 12:09:44 2015 >>> New Revision: 1692486 >>> +static int core_upgrade_handler(request_rec *r) >>> +{ >>> + conn_rec *c = r->connection; >>> + const char *upgrade = apr_table_get(r->headers_in, "Upgrade"); >>> + >>> + if (upgrade && *upgrade) { >>> + const char *conn = apr_table_get(r->headers_in, "Connection"); >>> + if (ap_find_token(r->pool, conn, "upgrade")) { >>> + apr_array_header_t *offers = NULL; >>> + const char *err; >>> + >>> + err = ap_parse_token_list_strict(r->pool, upgrade, &offers, 0); >>> + if (err) { >>> + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02910) >>> + "parsing Upgrade header: %s", err); >>> + return DECLINED; >>> + } >>> + >>> + if (offers && offers->nelts > 0) { >>> + const char *protocol = ap_select_protocol(c, r, r->server, >>> + offers); >>> + if (strcmp(protocol, ap_run_protocol_get(c))) { >>> + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02909) >>> + "Upgrade selects '%s'", protocol); >>> + /* Let the client know what we are upgrading to. */ >>> + apr_table_clear(r->headers_out); >>> + apr_table_setn(r->headers_out, "Upgrade", protocol); >>> + apr_table_setn(r->headers_out, "Connection", "Upgrade"); >>> + >>> + r->status = HTTP_SWITCHING_PROTOCOLS; >>> + r->status_line = ap_get_status_line(r->status); >>> + ap_send_interim_response(r, 1); >>> + >>> + ap_switch_protocol(c, r, r->server, protocol); >>> + >>> + /* make sure httpd closes the connection after this */ >>> + c->keepalive = AP_CONN_CLOSE; >>> + ap_lingering_close(c); >>> + >>> + if (c->sbh) { >>> + ap_update_child_status_from_conn(c->sbh, >>> + SERVER_CLOSING, c); >>> + } >> >> The c->keepalive = AP_CONN_CLOSE looks fine to me, but why should we do the other stuff in a handler. >> IMHO that should be done by the existing code. > > Not sure I understand. You mean the interim response or the whole handler? No I mean the ap_lingering_close(c); and the scoreboard update. Regards RĂ¼diger