httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgau...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/network_io/unix sendrecv.c
Date Thu, 02 Mar 2000 07:58:39 GMT
dgaudet     00/03/01 23:58:39

  Modified:    src/lib/apr/network_io/unix sendrecv.c
  Log:
  - there's a few cases where rv == -1 is possible, but APR_SUCCESS is returned
    which seems wrong.  it's not clear to me from reading apr_errno.h how
    i take a generic errno value from unix and translate it into an APR error
    so i'm not sure how to fix these.
  
  - the only API which makes sense to me is one in which the *len parameter
    always contains a correct value on return... and -1 doesn't seem at
    all correct given that it's not possible to write -1 bytes -- errors
    are returned through other means.
  
  Revision  Changes    Path
  1.12      +18 -4     apache-2.0/src/lib/apr/network_io/unix/sendrecv.c
  
  Index: sendrecv.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sendrecv.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- sendrecv.c	2000/03/02 07:19:41	1.11
  +++ sendrecv.c	2000/03/02 07:58:38	1.12
  @@ -126,6 +126,7 @@
               }
           }
       }
  +    /* XXX: if rv == -1 this is wrong. */
       (*len) = rv;
       return APR_SUCCESS;
   }
  @@ -191,6 +192,7 @@
           (*len) = 0;
           return errno;
       }
  +    /* XXX: if rv == -1 this is wrong. */
       (*len) = rv;
       return APR_SUCCESS;
   }
  @@ -249,6 +251,7 @@
               } while (rv == -1 && errno == EINTR);
           }
       }
  +    /* XXX: if rv == -1 this is wrong. */
       (*nbytes) = rv;
       return APR_SUCCESS;
   }
  @@ -296,6 +299,7 @@
           ap_int32_t hdrbytes;
           rv = ap_sendv(sock, hdtr->headers, hdtr->numheaders, &hdrbytes);
           if (rv != APR_SUCCESS) {
  +	    *len = 0;
               return errno;
           }
           nbytes += hdrbytes;
  @@ -329,10 +333,12 @@
           } while (srv == -1 && errno == EINTR);
   
           if (srv == 0) {
  +	    /* XXX: -1 bytes sent?  that's wrong */
               (*len) = -1;
               return APR_TIMEUP;
           }
           else if (srv < 0) {
  +	    /* XXX: -1 bytes sent?  that's wrong */
               (*len) = -1;
               return errno;
           }
  @@ -347,6 +353,7 @@
       }
   
       if (rv == -1) {
  +	*len = nbytes;
           return errno;
       }
   
  @@ -356,10 +363,11 @@
       if (hdtr->numtrailers > 0) {
           ap_int32_t trbytes;
           rv = ap_sendv(sock, hdtr->trailers, hdtr->numtrailers, &trbytes);
  +        nbytes += trbytes;
           if (rv == -1) {
  +	    *len = nbytes;
               return errno;
           }
  -        nbytes += trbytes;
       }
   
       /* Uncork to send queued frames */
  @@ -368,6 +376,7 @@
                       (const void *) &corkflag, sizeof(corkflag));
   
       (*len) = nbytes;
  +    /* XXX: this is wrong if rv == -1 */
       return APR_SUCCESS;
   }
   
  @@ -425,10 +434,12 @@
           } while (srv == -1 && errno == EINTR);
   
           if (srv == 0) {
  +	    /* XXX: -1 is wrong */
               (*len) = -1;
               return APR_TIMEUP;
           }
           else if (srv < 0) {
  +	    /* XXX: -1 is wrong */
               (*len) = -1;
               return errno;
           }
  @@ -445,13 +456,11 @@
               } while (rv == -1 && errno == EINTR);
           }
       }
  -
   
  +    (*len) = nbytes;
       if (rv == -1) {
           return errno;
       }
  -
  -    (*len) = nbytes;
       return APR_SUCCESS;
   }
   
  @@ -506,6 +515,7 @@
           rv = sendfile(sock->socketdes,	/* socket  */
           	      file->filedes,	/* file descriptor to send */
           	      *offset,	/* where in the file to start */
  +		      /* XXX: as far as i can see, nbytes == 0 always here -djg */
           	      nbytes,	/* number of bytes to send */
           	      hdtrarray,	/* Headers/footers */
           	      flags	/* undefined, set to 0 */
  @@ -533,10 +543,12 @@
           } while (srv == -1 && errno == EINTR);
   
           if (srv == 0) {
  +	    /* XXX: -1 is wrong */
               (*len) = -1;
               return APR_TIMEUP;
           }
           else if (srv < 0) {
  +	    /* XXX: -1 is wrong */
               (*len) = -1;
               return errno;
           }
  @@ -545,6 +557,7 @@
           	rv = sendfile(sock->socketdes,	/* socket  */
           		      file->filedes,	/* file descriptor to send */
           		      *offset,	/* where in the file to start */
  +				/* XXX: as far as i can see, nbytes == 0 always here -djg */
           		      nbytes,	/* number of bytes to send */
           		      hdtrarray,	/* Headers/footers */
           		      flags	/* undefined, set to 0 */
  @@ -555,6 +568,7 @@
   
   
       if (rv == -1) {
  +	*len = 0;
           return errno;
       }
   
  
  
  

Mime
View raw message