You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@apache.org on 2004/01/29 04:20:15 UTC

cvs commit: httpd-2.0/server/mpm/winnt child.c mpm_winnt.c mpm_winnt.h

stoddard    2004/01/28 19:20:15

  Modified:    .        Tag: APACHE_2_0_BRANCH CHANGES STATUS
               server/mpm/winnt Tag: APACHE_2_0_BRANCH child.c mpm_winnt.c
                        mpm_winnt.h
  Log:
  Win32: Port Win32DisableAcceptEx from 2.1
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.988.2.221 +7 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.988.2.220
  retrieving revision 1.988.2.221
  diff -u -r1.988.2.220 -r1.988.2.221
  --- CHANGES	28 Jan 2004 19:47:27 -0000	1.988.2.220
  +++ CHANGES	29 Jan 2004 03:20:13 -0000	1.988.2.221
  @@ -1,4 +1,11 @@
   Changes with Apache 2.0.49
  +  *) Win32: Add Win32DisableAcceptEx directive. This Windows
  +     NT/2000/CP directive is useful to work around bugs in some 
  +     third party layered service providers like virus scanners, 
  +     VPN and firewall products, that do not properly handle 
  +     WinSock 2 APIs.  Use this directive if your server is issuing
  +     AcceptEx failed messages.
  +     [Allan Edwards, Bill Rowe, Bill Stoddard, Jeff Trawick]
   
     *) Make REMOTE_PORT variable available in mod_rewrite.
        PR 25772.  [Andr� Malo]
  
  
  
  1.751.2.654 +1 -10     httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.751.2.653
  retrieving revision 1.751.2.654
  diff -u -r1.751.2.653 -r1.751.2.654
  --- STATUS	28 Jan 2004 22:35:54 -0000	1.751.2.653
  +++ STATUS	29 Jan 2004 03:20:14 -0000	1.751.2.654
  @@ -113,15 +113,6 @@
         http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/proxy/proxy_http.c?r1=1.176&r2=1.177 
         +1: stoddard, nd
   
  -    * Win32: Port Win32DisableAcceptEx directive. This fix enables using
  -      Winsock 1.1 accept() call in place of Winsock 2.0 AcceptEx() to work 
  -      around bugs in third party layered service providers (e.g. virus
  -      scanners) that do not properly handle various Winsock 2 APIs.
  -      http://cvs.apache.org/viewcvs.cgi/httpd-2.0/server/mpm/winnt/child.c?r1=1.19&r2=1.20
  -      http://cvs.apache.org/viewcvs.cgi/httpd-2.0/server/mpm/winnt/mpm_winnt.c?r1=1.301&r2=1.302
  -      http://cvs.apache.org/viewcvs.cgi/httpd-2.0/server/mpm/winnt/mpm_winnt.h?r1=1.42&r2=1.43
  -      +1: stoddard, trawick (with subsequent change to messages), ake
  -
       * If large file support is enabled, allow any file that is greater than
         AP_MAX_SENDFILE to be split into multiple buckets. This allows Apache
         to send files that are greater than 2gig. Otherwise we run into 
  
  
  
  No                   revision
  No                   revision
  1.9.2.7   +17 -7     httpd-2.0/server/mpm/winnt/child.c
  
  Index: child.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/child.c,v
  retrieving revision 1.9.2.6
  retrieving revision 1.9.2.7
  diff -u -r1.9.2.6 -r1.9.2.7
  --- child.c	1 Jan 2004 13:30:45 -0000	1.9.2.6
  +++ child.c	29 Jan 2004 03:20:14 -0000	1.9.2.7
  @@ -709,11 +709,11 @@
           ap_update_child_status_from_indexes(0, thread_num, SERVER_READY, NULL);
   
           /* Grab a connection off the network */
  -        if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
  -            context = win9x_get_connection(context);
  +        if (use_acceptex) {
  +            context = winnt_get_connection(context);
           }
           else {
  -            context = winnt_get_connection(context);
  +            context = win9x_get_connection(context);
           }
           if (!context) {
               /* Time for the thread to exit */
  @@ -741,6 +741,16 @@
                   context->accept_socket = INVALID_SOCKET;
                   ap_lingering_close(c);
               }
  +            else if (!use_acceptex) {
  +                /* If the socket is disconnected but we are not using acceptex, 
  +                 * we cannot reuse the socket. Disconnected sockets are removed
  +                 * from the apr_socket_t struct by apr_sendfile() to prevent the
  +                 * socket descriptor from being inadvertently closed by a call 
  +                 * to apr_socket_close(), so close it directly.
  +                 */
  +                closesocket(context->accept_socket);
  +                context->accept_socket = INVALID_SOCKET;
  +            }
           }
           else {
               /* ap_run_create_connection closes the socket on failure */
  @@ -777,7 +787,7 @@
   static void create_listener_thread()
   {
       int tid;
  -    if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
  +    if (!use_acceptex) {
           _beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE) win9x_accept,
                          NULL, 0, &tid);
       } else {
  @@ -1015,7 +1025,7 @@
       }
   
       /* Shutdown the worker threads */
  -    if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
  +    if (!use_acceptex) {
           for (i = 0; i < threads_created; i++) {
               add_job(INVALID_SOCKET);
           }
  @@ -1073,8 +1083,8 @@
   
       CloseHandle(allowed_globals.jobsemaphore);
       apr_thread_mutex_destroy(allowed_globals.jobmutex);
  -    if (osver.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS) {
  -    	apr_thread_mutex_destroy(qlock);
  +    if (use_acceptex) {
  +        apr_thread_mutex_destroy(qlock);
           CloseHandle(qwait_event);
       }
   
  
  
  
  1.296.2.4 +16 -0     httpd-2.0/server/mpm/winnt/mpm_winnt.c
  
  Index: mpm_winnt.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
  retrieving revision 1.296.2.3
  retrieving revision 1.296.2.4
  diff -u -r1.296.2.3 -r1.296.2.4
  --- mpm_winnt.c	1 Jan 2004 13:30:45 -0000	1.296.2.3
  +++ mpm_winnt.c	29 Jan 2004 03:20:14 -0000	1.296.2.4
  @@ -103,6 +103,7 @@
   DWORD my_pid;
   
   int ap_threads_per_child = 0;
  +int use_acceptex = 1;
   static int thread_limit = DEFAULT_THREAD_LIMIT;
   static int first_thread_limit = 0;
   static int changed_limit_at_restart;
  @@ -217,6 +218,19 @@
       }
       return NULL;
   }
  +static const char *set_disable_acceptex(cmd_parms *cmd, void *dummy, char *arg) 
  +{
  +    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  +    if (err != NULL) {
  +        return err;
  +    }
  +    if (use_acceptex) {
  +        use_acceptex = 0;
  +        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, 
  +                     "Disabled use of AcceptEx() WinSock2 API");
  +    }
  +    return NULL;
  +}
   
   static const command_rec winnt_cmds[] = {
   LISTEN_COMMANDS,
  @@ -224,6 +238,8 @@
     "Number of threads each child creates" ),
   AP_INIT_TAKE1("ThreadLimit", set_thread_limit, NULL, RSRC_CONF,
     "Maximum worker threads in a server for this run of Apache"),
  +AP_INIT_NO_ARGS("Win32DisableAcceptEx", set_disable_acceptex, NULL, RSRC_CONF,
  +  "Disable use of the high performance AcceptEx WinSock2 API to work around buggy VPN or Firewall software"),
   { NULL }
   };
   
  
  
  
  1.40.2.3  +1 -1      httpd-2.0/server/mpm/winnt/mpm_winnt.h
  
  Index: mpm_winnt.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.h,v
  retrieving revision 1.40.2.2
  retrieving revision 1.40.2.3
  diff -u -r1.40.2.2 -r1.40.2.3
  --- mpm_winnt.h	1 Jan 2004 13:30:45 -0000	1.40.2.2
  +++ mpm_winnt.h	29 Jan 2004 03:20:14 -0000	1.40.2.3
  @@ -100,7 +100,7 @@
   void mpm_nt_eventlog_stderr_flush(void);
   
   /* From winnt.c: */
  -
  +extern int use_acceptex;
   extern OSVERSIONINFO osver;
   extern void clean_child_exit(int);