httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1135153 - in /httpd/httpd/trunk: ./ docs/manual/developer/ include/ modules/echo/ modules/experimental/ modules/filters/ modules/http/ modules/proxy/ server/
Date Mon, 13 Jun 2011 16:02:19 GMT
Author: sf
Date: Mon Jun 13 16:02:18 2011
New Revision: 1135153

URL: http://svn.apache.org/viewvc?rev=1135153&view=rev
Log:
Introduce new function ap_get_conn_socket() to access the socket of
a connection

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/developer/new_api_2_4.xml
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/http_core.h
    httpd/httpd/trunk/modules/echo/mod_echo.c
    httpd/httpd/trunk/modules/experimental/mod_noloris.c
    httpd/httpd/trunk/modules/filters/mod_reqtimeout.c
    httpd/httpd/trunk/modules/http/http_core.c
    httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c
    httpd/httpd/trunk/modules/proxy/mod_proxy_fdpass.c
    httpd/httpd/trunk/server/connection.c
    httpd/httpd/trunk/server/core.c
    httpd/httpd/trunk/server/protocol.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon Jun 13 16:02:18 2011
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.13
 
+  *) core: Introduce new function ap_get_conn_socket() to access the socket of
+     a connection. [Stefan Fritsch]
+
   *) mod_data: Introduce a filter to support RFC2397 data URLs. [Graham
      Leggett]
 

Modified: httpd/httpd/trunk/docs/manual/developer/new_api_2_4.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/developer/new_api_2_4.xml?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/developer/new_api_2_4.xml (original)
+++ httpd/httpd/trunk/docs/manual/developer/new_api_2_4.xml Mon Jun 13 16:02:18 2011
@@ -118,6 +118,9 @@
           initial configuration preflight phase or not. This is both easier to
           use and more correct than the old method of creating a pool userdata
           entry in the process pool.</li>
+      <li>New function ap_get_conn_socket to get the socket descriptor for a
+          connection. This should be used instead of accessing the core
+          connection config directly.</li>
     </ul>
   </section>
 

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Mon Jun 13 16:02:18 2011
@@ -332,6 +332,7 @@
  *                         context_document_root, context_prefix.
  *                         Add ap_context_*(), ap_set_context_info(), ap_set_document_root()
  * 20110605.1 (2.3.13-dev) add ap_(get|set)_core_module_config()
+ * 20110605.2 (2.3.13-dev) add ap_get_conn_socket()
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -339,7 +340,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20110605
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 1                    /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 2                    /* 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=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_core.h (original)
+++ httpd/httpd/trunk/include/http_core.h Mon Jun 13 16:02:18 2011
@@ -336,6 +336,13 @@ AP_DECLARE(void *) ap_get_core_module_co
  */
 AP_DECLARE(void) ap_set_core_module_config(ap_conf_vector_t *cv, void *val);
 
+/** Get the socket from the core network filter. This should be used instead of
+ * accessing the core connection config directly.
+ * @param c The connection record
+ * @return The socket
+ */
+AP_DECLARE(apr_socket_t *) ap_get_conn_socket(conn_rec *c);
+
 #ifndef AP_DEBUG
 #define AP_CORE_MODULE_INDEX  0
 #define ap_get_core_module_config(v) \

Modified: httpd/httpd/trunk/modules/echo/mod_echo.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/echo/mod_echo.c?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/echo/mod_echo.c (original)
+++ httpd/httpd/trunk/modules/echo/mod_echo.c Mon Jun 13 16:02:18 2011
@@ -168,7 +168,7 @@ static int process_echo_connection(conn_
         }
 
         if (!csd) {
-            csd = ap_get_core_module_config(c->conn_config);
+            csd = ap_get_conn_socket(c);
             apr_socket_timeout_set(csd, c->base_server->keep_alive_timeout);
         }
 

Modified: httpd/httpd/trunk/modules/experimental/mod_noloris.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/experimental/mod_noloris.c?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/experimental/mod_noloris.c (original)
+++ httpd/httpd/trunk/modules/experimental/mod_noloris.c Mon Jun 13 16:02:18 2011
@@ -68,7 +68,7 @@ static int noloris_conn(conn_rec *conn)
     shm_rec = apr_shm_baseaddr_get(shm);
     while (shm_rec[0] != '\0') {
         if (!strcmp(shm_rec, conn->remote_ip)) {
-            apr_socket_t *csd = ap_get_core_module_config(conn->conn_config);
+            apr_socket_t *csd = ap_get_conn_socket(conn);
             ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, conn,
                           "Dropping connection from banned IP %s",
                           conn->remote_ip);

Modified: httpd/httpd/trunk/modules/filters/mod_reqtimeout.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_reqtimeout.c?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_reqtimeout.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_reqtimeout.c Mon Jun 13 16:02:18 2011
@@ -186,7 +186,7 @@ static apr_status_t reqtimeout_filter(ap
     }
 
     if (!ccfg->socket) {
-        ccfg->socket = ap_get_core_module_config(f->c->conn_config);
+        ccfg->socket = ap_get_conn_socket(f->c);
     }
 
     rv = check_time_left(ccfg, &time_left);

Modified: httpd/httpd/trunk/modules/http/http_core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_core.c?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_core.c (original)
+++ httpd/httpd/trunk/modules/http/http_core.c Mon Jun 13 16:02:18 2011
@@ -208,7 +208,7 @@ static int ap_process_http_sync_connecti
         }
 
         if (!csd) {
-            csd = ap_get_core_module_config(c->conn_config);
+            csd = ap_get_conn_socket(c);
         }
         apr_socket_opt_set(csd, APR_INCOMPLETE_READ, 1);
         apr_socket_timeout_set(csd, c->base_server->keep_alive_timeout);

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c Mon Jun 13 16:02:18 2011
@@ -209,7 +209,7 @@ static int proxy_connect_handler(request
     apr_status_t err, rv;
     apr_size_t nbytes;
     char buffer[HUGE_STRING_LEN];
-    apr_socket_t *client_socket = ap_get_core_module_config(c->conn_config);
+    apr_socket_t *client_socket = ap_get_conn_socket(c);
     int failed, rc;
     int client_error = 0;
     apr_pollset_t *pollset;

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_fdpass.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_fdpass.c?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_fdpass.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_fdpass.c Mon Jun 13 16:02:18 2011
@@ -221,9 +221,7 @@ static int proxy_fdpass_handler(request_
         }
     }
 
-    /* XXXXX: THIS IS AN EVIL HACK */
-    /* There should really be a (documented) public API for this ! */
-    clientsock = ap_get_core_module_config(r->connection->conn_config);
+    clientsock = ap_get_conn_socket(r->connection);
 
     rv = send_socket(r->pool, sock, clientsock);
     if (rv != APR_SUCCESS) {

Modified: httpd/httpd/trunk/server/connection.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/connection.c?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/server/connection.c (original)
+++ httpd/httpd/trunk/server/connection.c Mon Jun 13 16:02:18 2011
@@ -98,7 +98,7 @@ AP_DECLARE(void) ap_lingering_close(conn
     char dummybuf[512];
     apr_size_t nbytes;
     apr_time_t timeup = 0;
-    apr_socket_t *csd = ap_get_core_module_config(c->conn_config);
+    apr_socket_t *csd = ap_get_conn_socket(c);
 
     if (!csd) {
         return;

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Mon Jun 13 16:02:18 2011
@@ -4302,6 +4302,11 @@ AP_DECLARE(void **) ap_get_request_note(
     return &(req_cfg->notes[note_num]);
 }
 
+AP_DECLARE(apr_socket_t *) ap_get_conn_socket(conn_rec *c)
+{
+    return ap_get_core_module_config(c->conn_config);
+}
+
 static int core_create_req(request_rec *r)
 {
     /* Alloc the config struct and the array of request notes in

Modified: httpd/httpd/trunk/server/protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=1135153&r1=1135152&r2=1135153&view=diff
==============================================================================
--- httpd/httpd/trunk/server/protocol.c (original)
+++ httpd/httpd/trunk/server/protocol.c Mon Jun 13 16:02:18 2011
@@ -953,7 +953,7 @@ request_rec *ap_read_request(conn_rec *c
      * to the normal timeout mode as we fetch the header lines,
      * as necessary.
      */
-    csd = ap_get_core_module_config(conn->conn_config);
+    csd = ap_get_conn_socket(conn);
     apr_socket_timeout_get(csd, &cur_timeout);
     if (cur_timeout != conn->base_server->timeout) {
         apr_socket_timeout_set(csd, conn->base_server->timeout);



Mime
View raw message