httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject svn commit: r157583 - in httpd/httpd/trunk: CHANGES include/ap_listen.h server/listen.c
Date Tue, 15 Mar 2005 20:05:02 GMT
Author: jerenkrantz
Date: Tue Mar 15 12:04:58 2005
New Revision: 157583

URL: http://svn.apache.org/viewcvs?view=rev&rev=157583
Log:
Add ReceiveBufferSize directive to control the TCP receive buffer.

Submitted by: Eric Covener <covener gmail.com>
Reviewed by:  Justin Erenkrantz (with minor formatting tweaks)

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/include/ap_listen.h
    httpd/httpd/trunk/server/listen.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?view=diff&r1=157582&r2=157583
==============================================================================
--- httpd/httpd/trunk/CHANGES (original)
+++ httpd/httpd/trunk/CHANGES Tue Mar 15 12:04:58 2005
@@ -2,6 +2,9 @@
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Add ReceiveBufferSize directive to control the TCP receive buffer.
+     [Eric Covener <covener gmail.com>]
+
   *) mod_proxy: Add proxy-sendextracrlf option to send an extra CRLF at the
      end of the request body to work with really old HTTP servers.
      [Justin Erenkrantz]
@@ -9,7 +12,7 @@
   *) util_ldap: Keep track of the number of attributes retrieved from 
      LDAP so that all the values can be properly cached even if the 
      value is NULL. PR 33901 [Brad Nicholes]
-  
+
   *) mod_cache: Fix error where incoming Cache-Control would be ignored.
      [Justin Erenkrantz]
 

Modified: httpd/httpd/trunk/include/ap_listen.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/include/ap_listen.h?view=diff&r1=157582&r2=157583
==============================================================================
--- httpd/httpd/trunk/include/ap_listen.h (original)
+++ httpd/httpd/trunk/include/ap_listen.h Tue Mar 15 12:04:58 2005
@@ -88,6 +88,9 @@
 AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy, const char *ips);
 AP_DECLARE_NONSTD(const char *) ap_set_send_buffer_size(cmd_parms *cmd, void *dummy,
 				    const char *arg);
+AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
+                                                           void *dummy,
+                                                           const char *arg);
 
 #define LISTEN_COMMANDS	\
 AP_INIT_TAKE1("ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, \
@@ -95,6 +98,8 @@
 AP_INIT_TAKE1("Listen", ap_set_listener, NULL, RSRC_CONF, \
   "A port number or a numeric IP address and a port number"), \
 AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \
-  "Send buffer size in bytes")
+  "Send buffer size in bytes"), \
+AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \
+              RSRC_CONF, "Receive buffer size in bytes")
 
 #endif

Modified: httpd/httpd/trunk/server/listen.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/listen.c?view=diff&r1=157582&r2=157583
==============================================================================
--- httpd/httpd/trunk/server/listen.c (original)
+++ httpd/httpd/trunk/server/listen.c Tue Mar 15 12:04:58 2005
@@ -34,6 +34,7 @@
 static ap_listen_rec *old_listeners;
 static int ap_listenbacklog;
 static int send_buffer_size;
+static int receive_buffer_size;
 
 /* TODO: make_sock is just begging and screaming for APR abstraction */
 static apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server)
@@ -112,6 +113,17 @@
             /* not a fatal error */
         }
     }
+    if (receive_buffer_size) {
+        stat = apr_socket_opt_set(s, APR_SO_RCVBUF, receive_buffer_size);
+        if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
+            ap_log_perror(APLOG_MARK, APLOG_WARNING, stat, p,
+                          "make_sock: failed to set ReceiveBufferSize for "
+                          "address %pI, using default",
+                          server->bind_addr);
+            strerror(errno);
+            /* not a fatal error */
+        }
+    }
 
 #if APR_TCP_NODELAY_INHERITED
     ap_sock_disable_nagle(s);
@@ -532,5 +544,24 @@
     }
 
     send_buffer_size = s;
+    return NULL;
+}
+
+AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
+                                                           void *dummy,
+                                                           const char *arg)
+{
+    int s = atoi(arg);
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+
+    if (err != NULL) {
+        return err;
+    }
+
+    if (s < 512 && s != 0) {
+        return "ReceiveBufferSize must be >= 512 bytes, or 0 for system default.";
+    }
+
+    receive_buffer_size = s;
     return NULL;
 }



Mime
View raw message