httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: apache-1.3/src/main buff.c
Date Tue, 26 Feb 2002 14:25:57 GMT
stoddard    02/02/26 06:25:56

  Modified:    src/main buff.c
  Log:
  Win32: Emulate the blocking send/recv calls that were called in these functions
  when the timeout was set to 0. This is a bit of a hack but it is an improvement
  over the original code. A better fix would involve making too many other changes
  to the server that I would prefer not to make in the 1.3 tree.
  
  Revision  Changes    Path
  1.108     +22 -0     apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- buff.c	9 Feb 2002 14:51:30 -0000	1.107
  +++ buff.c	26 Feb 2002 14:25:56 -0000	1.108
  @@ -139,6 +139,17 @@
   
       tv.tv_sec = ap_check_alarm();
   
  +    /* If ap_sendwithtimeout is called with an invalid timeout
  +     * set a default timeout of 300 seconds. This hack is needed
  +     * to emulate the non-blocking send() that was removed in 
  +     * the previous patch to this function. Network servers
  +     * should never make network i/o calls w/o setting a timeout.
  +     * (doing otherwise opens a DoS attack exposure)
  +     */
  +    if (tv.tv_sec <= 0) {
  +        tv.tv_sec = 300;
  +    }
  +
       rv = ioctlsocket(sock, FIONBIO, (u_long*)&iostate);
       iostate = 0;
       if (rv) {
  @@ -204,6 +215,17 @@
       int retry;
   
       tv.tv_sec = ap_check_alarm();
  +
  +    /* If ap_recvwithtimeout is called with an invalid timeout
  +     * set a default timeout of 300 seconds. This hack is needed
  +     * to emulate the non-blocking recv() that was removed in 
  +     * the previous patch to this function. Network servers
  +     * should never make network i/o calls w/o setting a timeout.
  +     * (doing otherwise opens a DoS attack exposure)
  +     */
  +    if (tv.tv_sec <= 0) {
  +        tv.tv_sec = 300;
  +    }
   
       rv = ioctlsocket(sock, FIONBIO, (u_long*)&iostate);
       iostate = 0;
  
  
  

Mime
View raw message