You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2018/02/17 21:39:53 UTC
svn commit: r1824635 - in /httpd/httpd/trunk: CHANGES include/ap_mmn.h
include/http_core.h server/Makefile.in server/core.c server/core.h
Author: minfrin
Date: Sat Feb 17 21:39:53 2018
New Revision: 1824635
URL: http://svn.apache.org/viewvc?rev=1824635&view=rev
Log:
core: Create a conn_config_t structure to hold an extendable core config rather
than consuming the whole pointer with the connection socket.
Added:
httpd/httpd/trunk/server/core.h
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/include/ap_mmn.h
httpd/httpd/trunk/include/http_core.h
httpd/httpd/trunk/server/Makefile.in
httpd/httpd/trunk/server/core.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1824635&r1=1824634&r2=1824635&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Feb 17 21:39:53 2018
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache 2.5.1
+ *) core: Create a conn_config_t structure to hold an extendable core config rather
+ than consuming the whole pointer with the connection socket. [Graham Leggett]
+
*) mpm_event: Do lingering close in worker(s). [Yann Ylavic]
*) mpm_queue: Put fdqueue code in common for MPMs event and worker.
Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1824635&r1=1824634&r2=1824635&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Sat Feb 17 21:39:53 2018
@@ -568,6 +568,7 @@
* 20171014.6 (2.5.1-dev) Add AP_REG_DOLLAR_ENDONLY, ap_regcomp_get_default_cflags
* ap_regcomp_set_default_cflags and
* ap_regcomp_default_cflag_by_name
+ * 20171014.7 (2.5.1-dev) Add AP_CORE_DEFAULT macro
*/
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
@@ -575,7 +576,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20171014
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 6 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 7 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
Modified: httpd/httpd/trunk/include/http_core.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_core.h?rev=1824635&r1=1824634&r2=1824635&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_core.h (original)
+++ httpd/httpd/trunk/include/http_core.h Sat Feb 17 21:39:53 2018
@@ -1112,6 +1112,11 @@ AP_DECLARE(int) ap_state_query(int query
*/
AP_CORE_DECLARE(conn_rec *) ap_create_slave_connection(conn_rec *c);
+
+/** Macro to provide a default value if the pointer is not yet initialised
+ */
+#define AP_CORE_DEFAULT(X, Y, Z) (X ? X->Y : Z)
+
#ifdef __cplusplus
}
#endif
Modified: httpd/httpd/trunk/server/Makefile.in
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/Makefile.in?rev=1824635&r1=1824634&r2=1824635&view=diff
==============================================================================
--- httpd/httpd/trunk/server/Makefile.in (original)
+++ httpd/httpd/trunk/server/Makefile.in Sat Feb 17 21:39:53 2018
@@ -68,6 +68,7 @@ export_files:
( for dir in $(EXPORT_DIRS); do \
ls $$dir/*.h ; \
done; \
+ echo "$(top_srcdir)/server/core.h"; \
echo "$(top_srcdir)/server/mpm_fdqueue.h"; \
for dir in $(EXPORT_DIRS_APR); do \
ls $$dir/ap[ru].h $$dir/ap[ru]_*.h 2>/dev/null; \
Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1824635&r1=1824634&r2=1824635&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Sat Feb 17 21:39:53 2018
@@ -50,6 +50,7 @@
#include "ap_listen.h"
#include "ap_provider.h"
#include "ap_regex.h"
+#include "core.h"
#include "mod_so.h" /* for ap_find_loaded_module_symbol */
@@ -5231,7 +5232,9 @@ AP_DECLARE(void **) ap_get_request_note(
AP_DECLARE(apr_socket_t *) ap_get_conn_socket(conn_rec *c)
{
- return ap_get_core_module_config(c->conn_config);
+ conn_config_t *conn_config = ap_get_core_module_config(c->conn_config);
+
+ return AP_CORE_DEFAULT(conn_config, socket, NULL);
}
static int core_create_req(request_rec *r)
@@ -5344,6 +5347,7 @@ static conn_rec *core_create_conn(apr_po
static int core_pre_connection(conn_rec *c, void *csd)
{
core_net_rec *net;
+ conn_config_t *conn_config;
apr_status_t rv;
if (c->master) {
@@ -5385,7 +5389,10 @@ static int core_pre_connection(conn_rec
net->out_ctx = NULL;
net->client_socket = csd;
- ap_set_core_module_config(net->c->conn_config, csd);
+ conn_config = apr_palloc(c->pool, sizeof(conn_config));
+ conn_config->socket = csd;
+ ap_set_core_module_config(net->c->conn_config, conn_config);
+
/* only the master connection talks to the network */
if (c->master == NULL) {
ap_add_input_filter_handle(ap_core_input_filter_handle, net, NULL,
Added: httpd/httpd/trunk/server/core.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.h?rev=1824635&view=auto
==============================================================================
--- httpd/httpd/trunk/server/core.h (added)
+++ httpd/httpd/trunk/server/core.h Sat Feb 17 21:39:53 2018
@@ -0,0 +1,39 @@
+/* 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.
+ */
+
+/**
+ * @file server/core.h
+ * @brief core private declarations
+ *
+ * @addtogroup APACHE_CORE
+ * @{
+ */
+
+#ifndef CORE_H
+#define CORE_H
+
+/**
+ * @brief A structure to contain connection state information
+ */
+typedef struct conn_config_t {
+ /** Socket belonging to the connection */
+ apr_socket_t *socket;
+} conn_config_t;
+
+
+#endif /* CORE_H */
+/** @} */
+