cvs commit: apache-1.3/src/main buff.c

1998-02-03 Thread randy
randy   98/02/02 18:41:22

  Modified:src/ap   Makefile.tmpl
   src/include ap.h
   src/main buff.c
  Added:   src/ap   ap_read.c ap_write.c
  Log:
  Abstract read() and write() to the ap library to make it easier
  to add in different types of read/write libraries in a central
  location. This mainly keeps buff.c less messy with #ifdefs.
  
  Revision  ChangesPath
  1.10  +4 -1  apache-1.3/src/ap/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===
  RCS file: /export/home/cvs/apache-1.3/src/ap/Makefile.tmpl,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Makefile.tmpl 1998/02/01 15:56:21 1.9
  +++ Makefile.tmpl 1998/02/03 02:41:19 1.10
  @@ -6,7 +6,8 @@
   
   LIB=libap.a
   
  -OBJS=ap_signal.o ap_slack.o ap_snprintf.o ap_strings.o ap_cpystrn.o 
ap_execve.o
  +OBJS=ap_signal.o ap_slack.o ap_snprintf.o ap_strings.o ap_cpystrn.o \
  + ap_execve.o ap_read.o ap_write.o
   
   .c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
  @@ -30,3 +31,5 @@
   ap_strings.o: $(INCDIR)/httpd.h
   ap_cpystrn.o: $(INCDIR)/httpd.h
   ap_execve.o: $(INCDIR)/httpd.h $(INCDIR)/http_log.h
  +ap_read.o: $(INCDIR)/httpd.h
  +ap_write.o: $(INCDIR)/httpd.h
  
  
  
  1.1  apache-1.3/src/ap/ap_read.c
  
  Index: ap_read.c
  ===
  /* 
   * Copyright (c) 1995-1998 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. All advertising materials mentioning features or use of this
   *software must display the following acknowledgment:
   *"This product includes software developed by the Apache Group
   *for use in the Apache HTTP server project (http://www.apache.org/)."
   *
   * 4. The names "Apache Server" and "Apache Group" must not be used to
   *endorse or promote products derived from this software without
   *prior written permission. For written permission, please contact
   *[EMAIL PROTECTED]
   *
   * 5. Redistributions of any form whatsoever must retain the following
   *acknowledgment:
   *"This product includes software developed by the Apache Group
   *for use in the Apache HTTP server project (http://www.apache.org/)."
   *
   * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
   * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Group and was originally based
   * on public domain software written at the National Center for
   * Supercomputing Applications, University of Illinois, Urbana-Champaign.
   * For more information on the Apache Group and the Apache HTTP server
   * project, please see .
   *
   */
  
  #include "httpd.h"
  
  /* the lowest level reading primitive */
  
  API_EXPORT(int) ap_read(BUFF *fb, void *buf, int nbyte)
  {
  int rv;
  
  rv = read(fb->fd_in, buf, nbyte);
  
  return rv;
  }
  
  
  
  
  1.1  apache-1.3/src/ap/ap_write.c
  
  Index: ap_write.c
  ===
  /* 
   * Copyright (c) 1995-1998 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyri

cvs commit: apache-1.3/src/main buff.c

1998-02-03 Thread randy
randy   98/02/03 12:00:59

  Modified:src/ap   Makefile.tmpl
   src/include ap.h
   src/main buff.c
  Removed: src/ap   ap_read.c ap_write.c
  Log:
  Back out controversial abstraction of read()/write(). As couple
  of people have pointed out, this is probably too major a change
  this late in the game. My main intent was to clean up some of
  the code where read()/write() is called in buff.c. Putting these
  in libap seemed the logical place, but opens a whole can of worms
  I did not forsee.
  
  Revision  ChangesPath
  1.11  +1 -3  apache-1.3/src/ap/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===
  RCS file: /export/home/cvs/apache-1.3/src/ap/Makefile.tmpl,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Makefile.tmpl 1998/02/03 02:41:19 1.10
  +++ Makefile.tmpl 1998/02/03 20:00:55 1.11
  @@ -7,7 +7,7 @@
   LIB=libap.a
   
   OBJS=ap_signal.o ap_slack.o ap_snprintf.o ap_strings.o ap_cpystrn.o \
  - ap_execve.o ap_read.o ap_write.o
  + ap_execve.o
   
   .c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
  @@ -31,5 +31,3 @@
   ap_strings.o: $(INCDIR)/httpd.h
   ap_cpystrn.o: $(INCDIR)/httpd.h
   ap_execve.o: $(INCDIR)/httpd.h $(INCDIR)/http_log.h
  -ap_read.o: $(INCDIR)/httpd.h
  -ap_write.o: $(INCDIR)/httpd.h
  
  
  
  1.6   +0 -2  apache-1.3/src/include/ap.h
  
  Index: ap.h
  ===
  RCS file: /export/home/cvs/apache-1.3/src/include/ap.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ap.h  1998/02/03 02:41:21 1.5
  +++ ap.h  1998/02/03 20:00:57 1.6
  @@ -57,8 +57,6 @@
   #ifndef APACHE_AP_H
   #define APACHE_AP_H
   
  -API_EXPORT(int) ap_read(BUFF *fb, void *buf, int nbyte);
  -API_EXPORT(int) ap_write(BUFF *fb, const void *buf, int nbyte);
   API_EXPORT(char *) ap_cpystrn(char *, const char *, size_t);
   int ap_slack(int, int);
   API_EXPORT(char *) ap_escape_quotes(pool *, const char *);
  
  
  
  1.62  +23 -0 apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- buff.c1998/02/03 02:41:22 1.61
  +++ buff.c1998/02/03 20:00:58 1.62
  @@ -221,7 +221,17 @@
   
   #endif /* WIN32 */
   
  +
   /* the lowest level reading primitive */
  +static int ap_read(BUFF *fb, void *buf, int nbyte)
  +{
  +int rv;
  +
  +rv = read(fb->fd_in, buf, nbyte);
  +
  +return rv;
  +}
  +
   static ap_inline int buff_read(BUFF *fb, void *buf, int nbyte)
   {
   int rv;
  @@ -241,6 +251,19 @@
   }
   
   /* the lowest level writing primitive */
  +static int ap_write(BUFF *fb, const void *buf, int nbyte)
  +{
  +int rv;
  +
  +#if defined (B_SFIO)
  +rv = sfwrite(fb->sf_out, buf, nbyte);
  +#else
  +rv = write(fb->fd, buf, nbyte);
  +#endif
  +
  +return rv;
  +}
  +
   static ap_inline int buff_write(BUFF *fb, const void *buf, int nbyte)
   {
   int rv;
  
  
  


cvs commit: apache-1.3/src/main buff.c

1998-02-07 Thread dgaudet
dgaudet 98/02/07 02:34:47

  Modified:src/main buff.c
  Log:
  Sorry guys I know we're trying to get 1.3b4 rolled, but I really really
  really want chunking to work since it is affecting the deployment of
  HTTP/1.1.  I've stressed this patch a fair amount with a module I'll
  check in shortly.
  
  Two more chunking bugs:
  
  - start_chunk() called bflush() called start_chunk() caused chaos
  - if we ended up in the tail of bwrite() where a memcpy happens to copy
  the remainder, in certain boundary cases with chunking we would
  go past the end of the buffer
  
  Just generally clean up chunking a bit.  This would be a lot easier if
  chunking were just a layered I/O handler.
  
  Revision  ChangesPath
  1.63  +56 -47apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- buff.c1998/02/03 20:00:58 1.62
  +++ buff.c1998/02/07 10:34:43 1.63
  @@ -74,6 +74,13 @@
   #ifndef DEFAULT_BUFSIZE
   #define DEFAULT_BUFSIZE (4096)
   #endif
  +/* This must be enough to represent (DEFAULT_BUFSIZE - 3) in hex,
  + * plus two extra characters.
  + */
  +#ifndef CHUNK_HEADER_SIZE
  +#define CHUNK_HEADER_SIZE (5)
  +#endif
  +
   
   /* bwrite()s of greater than this size can result in a large_write() call,
* which can result in a writev().  It's a little more work to set up the
  @@ -381,6 +388,8 @@
   }
   }
   
  +static int bflush_core(BUFF *fb);
  +
   /*
* Start chunked encoding.
*
  @@ -392,9 +401,6 @@
*/
   static void start_chunk(BUFF *fb)
   {
  -char chunksize[16];  /* Big enough for practically anything 
*/
  -int chunk_header_size;
  -
   if (fb->outchunk != -1) {
/* already chunking */
return;
  @@ -404,26 +410,15 @@
return;
   }
   
  -/* we know that the chunk header is going to take at least 3 bytes... */
  -chunk_header_size = ap_snprintf(chunksize, sizeof(chunksize),
  -  "%x\015\012", fb->bufsiz - fb->outcnt - 3);
   /* we need at least the header_len + at least 1 data byte
* remember that we've overallocated fb->outbase so that we can always
* fit the two byte CRLF trailer
*/
  -if (fb->bufsiz - fb->outcnt < chunk_header_size + 1) {
  - bflush(fb);
  +if (fb->bufsiz - fb->outcnt < CHUNK_HEADER_SIZE + 1) {
  + bflush_core(fb);
   }
  -/* assume there's enough space now */
  -#ifdef CHARSET_EBCDIC
  -/* Chunks are an HTTP/1.1 Protocol feature. They must ALWAYS be in ASCII 
*/
  -ebcdic2ascii(&fb->outbase[fb->outcnt], chunksize, chunk_header_size);
  -#else /*CHARSET_EBCDIC*/
  -memcpy(&fb->outbase[fb->outcnt], chunksize, chunk_header_size);
  -#endif /*CHARSET_EBCDIC*/
   fb->outchunk = fb->outcnt;
  -fb->outcnt += chunk_header_size;
  -fb->outchunk_header_size = chunk_header_size;
  +fb->outcnt += CHUNK_HEADER_SIZE;
   }
   
   
  @@ -433,13 +428,14 @@
   static void end_chunk(BUFF *fb)
   {
   int i;
  +char *strp;
   
   if (fb->outchunk == -1) {
/* not chunking */
return;
   }
   
  -if (fb->outchunk + fb->outchunk_header_size == fb->outcnt) {
  +if (fb->outchunk + CHUNK_HEADER_SIZE == fb->outcnt) {
/* nothing was written into this chunk, and we can't write a 0 size
 * chunk because that signifies EOF, so just erase it
 */
  @@ -449,26 +445,24 @@
   }
   
   /* we know this will fit because of how we wrote it in start_chunk() */
  -i = ap_snprintf((char *) &fb->outbase[fb->outchunk],
  - fb->outchunk_header_size,
  - "%x", fb->outcnt - fb->outchunk - fb->outchunk_header_size);
  +i = ap_snprintf((char *) &fb->outbase[fb->outchunk], CHUNK_HEADER_SIZE,
  + "%x", fb->outcnt - fb->outchunk - CHUNK_HEADER_SIZE);
   
   /* we may have to tack some trailing spaces onto the number we just wrote
* in case it was smaller than our estimated size.  We've also written
* a \0 into the buffer with ap_snprintf so we might have to put a
* \r back in.
*/
  -i += fb->outchunk;
  -while (fb->outbase[i] != '\015' && fb->outbase[i] != '\012') {
  - fb->outbase[i++] = ' ';
  -}
  -if (fb->outbase[i] == '\012') {
  - /* we overwrote the \r, so put it back */
  - fb->outbase[i - 1] = '\015';
  +strp = &fb->outbase[fb->outchunk + i];
  +while (i < CHUNK_HEADER_SIZE - 2) {
  + *strp++ = ' ';
  + ++i;
   }
  +*strp++ = '\015';
  +*strp = '\012';
   #ifdef CHARSET_EBCDIC
   /* Chunks are an HTTP/1.1 Protocol feature. They must ALWAYS be in ASCII 
*/
  -ebcdic2ascii(&fb->outbase[fb->outchunk], &fb->outbase[fb->outchunk], 
fb->outchunk_header_size);
  +ebcdic2ascii(&fb->outbase[fb-

cvs commit: apache-1.3/src/main buff.c

1998-02-12 Thread dgaudet
dgaudet 98/02/12 13:13:19

  Modified:src/main buff.c
  Log:
  fix an unsigned char * / signed char * mistake.
  
  Revision  ChangesPath
  1.64  +1 -1  apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- buff.c1998/02/07 10:34:43 1.63
  +++ buff.c1998/02/12 21:13:18 1.64
  @@ -428,7 +428,7 @@
   static void end_chunk(BUFF *fb)
   {
   int i;
  -char *strp;
  +unsigned char *strp;
   
   if (fb->outchunk == -1) {
/* not chunking */
  
  
  


cvs commit: apache-1.3/src/main buff.c

1998-04-01 Thread dgaudet
dgaudet 98/03/31 17:31:13

  Modified:src/main buff.c
  Log:
  clean up "Pointers are not assignment-compatible." on hpux... I hate
  this char vs unsigned char crap.
  
  Revision  ChangesPath
  1.71  +6 -6  apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- buff.c1998/03/31 12:52:40 1.70
  +++ buff.c1998/04/01 01:31:12 1.71
  @@ -1465,8 +1465,8 @@
return -1;
}
   }
  -vbuff->curpos = &fb->outbase[fb->outcnt];
  -vbuff->endpos = &fb->outbase[fb->bufsiz];
  +vbuff->curpos = (char *)&fb->outbase[fb->outcnt];
  +vbuff->endpos = (char *)&fb->outbase[fb->bufsiz];
   return 0;
   }
   
  @@ -1476,8 +1476,8 @@
   int res;
   struct bprintf_data b;
   
  -b.vbuff.curpos = &fb->outbase[fb->outcnt];
  -b.vbuff.endpos = &fb->outbase[fb->bufsiz];
  +b.vbuff.curpos = (char *)&fb->outbase[fb->outcnt];
  +b.vbuff.endpos = (char *)&fb->outbase[fb->bufsiz];
   b.fb = fb;
   va_start(ap, fmt);
   res = ap_vformatter(bprintf_flush, &b.vbuff, fmt, ap);
  @@ -1493,8 +1493,8 @@
   struct bprintf_data b;
   int res;
   
  -b.vbuff.curpos = &fb->outbase[fb->outcnt];
  -b.vbuff.endpos = &fb->outbase[fb->bufsiz];
  +b.vbuff.curpos = (char *)&fb->outbase[fb->outcnt];
  +b.vbuff.endpos = (char *)&fb->outbase[fb->bufsiz];
   b.fb = fb;
   res = ap_vformatter(bprintf_flush, &b.vbuff, fmt, ap);
   if (res != -1) {
  
  
  


cvs commit: apache-1.3/src/main buff.c

1998-04-03 Thread martin
martin  98/04/03 06:55:46

  Modified:src/main buff.c
  Log:
  Integrate EBCDIC conversion into new bprintf() and friends. Fix an old
  bug with EBCDIC translation (sometimes, a necessary conversion was forgotten).
  
  Revision  ChangesPath
  1.72  +30 -2 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.71
  retrieving revision 1.72
  diff -u -u -r1.71 -r1.72
  --- buff.c1998/04/01 01:31:12 1.71
  +++ buff.c1998/04/03 14:55:45 1.72
  @@ -630,6 +630,9 @@
* Read up to nbyte bytes into buf.
* If fewer than byte bytes are currently available, then return those.
* Returns 0 for EOF, -1 for error.
  + * NOTE EBCDIC: The readahead buffer _always_ contains *unconverted* data.
  + * Only when the caller retrieves data from the buffer (calls bread)
  + * is a conversion done, if the conversion flag is set at that time.
*/
   API_EXPORT(int) bread(BUFF *fb, void *buf, int nbyte)
   {
  @@ -656,6 +659,10 @@
return i;
}
i = read_with_errors(fb, buf, nbyte);
  +#ifdef CHARSET_EBCDIC
  + if (i > 0 && bgetflag(fb, B_ASCII2EBCDIC))
  + ascii2ebcdic(buf, buf, i);
  +#endif /*CHARSET_EBCDIC*/
return i;
   }
   
  @@ -689,11 +696,11 @@
   
   /* do a single read */
   if (nbyte >= fb->bufsiz) {
  -/* read directly into buffer */
  +/* read directly into caller's buffer */
i = read_with_errors(fb, buf, nbyte);
   #ifdef CHARSET_EBCDIC
if (i > 0 && bgetflag(fb, B_ASCII2EBCDIC))
  - ascii2ebcdic(buf, buf, nbyte);
  + ascii2ebcdic(buf, buf, i);
   #endif /*CHARSET_EBCDIC*/
if (i == -1) {
return nrd ? nrd : -1;
  @@ -1459,6 +1466,13 @@
   struct bprintf_data *b = (struct bprintf_data *)vbuff;
   BUFF *fb = b->fb;
   
  +#ifdef CHARSET_EBCDIC
  +/* Characters were pushed into the buffer without conversion. Do it now 
*/
  +if (fb->flags & B_EBCDIC2ASCII)
  +ebcdic2ascii(&fb->outbase[fb->outcnt],
  +  &fb->outbase[fb->outcnt],
  +  b->vbuff.curpos - (char *)&fb->outbase[fb->outcnt]);
  +#endif /*CHARSET_EBCDIC*/
   fb->outcnt += b->vbuff.curpos - (char *)&fb->outbase[fb->outcnt];
   if (fb->outcnt == fb->bufsiz) {
if (bflush(fb)) {
  @@ -1483,6 +1497,13 @@
   res = ap_vformatter(bprintf_flush, &b.vbuff, fmt, ap);
   va_end(ap);
   if (res != -1) {
  +#ifdef CHARSET_EBCDIC
  + /* Characters were pushed into the buffer without conversion. Do it now 
*/
  + if (fb->flags & B_EBCDIC2ASCII)
  + ebcdic2ascii(&fb->outbase[fb->outcnt],
  +  &fb->outbase[fb->outcnt],
  +  b.vbuff.curpos - (char *)&fb->outbase[fb->outcnt]);
  +#endif /*CHARSET_EBCDIC*/
fb->outcnt += b.vbuff.curpos - (char *)&fb->outbase[fb->outcnt];
   }
   return res;
  @@ -1498,6 +1519,13 @@
   b.fb = fb;
   res = ap_vformatter(bprintf_flush, &b.vbuff, fmt, ap);
   if (res != -1) {
  +#ifdef CHARSET_EBCDIC
  + /* Characters were pushed into the buffer without conversion. Do it now 
*/
  + if (fb->flags & B_EBCDIC2ASCII)
  + ebcdic2ascii(&fb->outbase[fb->outcnt],
  +  &fb->outbase[fb->outcnt],
  +  b.vbuff.curpos - (char *)&fb->outbase[fb->outcnt]);
  +#endif /*CHARSET_EBCDIC*/
fb->outcnt += b.vbuff.curpos - (char *)&fb->outbase[fb->outcnt];
   }
   return res;
  
  
  


cvs commit: apache-1.3/src/main buff.c

1998-05-08 Thread brian
brian   98/05/08 15:54:52

  Modified:src/main buff.c
  Log:
  PR: 2207
  
  Marc's suggestion that we move this to debug, which I agree with.
  
  Revision  ChangesPath
  1.75  +1 -1  apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- buff.c1998/04/27 06:59:35 1.74
  +++ buff.c1998/05/08 22:54:52 1.75
  @@ -168,7 +168,7 @@
if (rv == SOCKET_ERROR) {
err = WSAGetLastError();
if(err == WSAEWOULDBLOCK) {
  - ap_log_error(APLOG_MARK,APLOG_WARNING,NULL,
  + ap_log_error(APLOG_MARK,APLOG_DEBUG,NULL,
"select claimed we could write, but in fact we 
couldn't. This is a bug in Windows.");
retry=1;
Sleep(100);
  
  
  


cvs commit: apache-1.3/src/main buff.c

1998-06-04 Thread dgaudet
dgaudet 98/06/04 12:58:58

  Modified:src  CHANGES
   src/main buff.c
  Log:
  PORT: F_NDELAY is a typo, should have been FNDELAY.  There's also
  O_NDELAY on various systems.
  
  PR:   2313
  Submitted by: Dave Dykstra <[EMAIL PROTECTED]>
  
  Revision  ChangesPath
  1.884 +3 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.883
  retrieving revision 1.884
  diff -u -r1.883 -r1.884
  --- CHANGES   1998/06/04 19:49:25 1.883
  +++ CHANGES   1998/06/04 19:58:54 1.884
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3.1
   
  +  *) PORT: F_NDELAY is a typo, should have been FNDELAY.  There's also
  + O_NDELAY on various systems.  [Dave Dykstra <[EMAIL PROTECTED]>] PR#2313
  +
 *) PORT: SVR4 v3.0.1 running on ncr S10 (3404) host.
[juerg schreiner <[EMAIL PROTECTED]>] PR#2310
   
  
  
  
  1.77  +4 -2  apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- buff.c1998/05/16 16:34:48 1.76
  +++ buff.c1998/06/04 19:58:57 1.77
  @@ -529,8 +529,10 @@
   fd = (direction == B_RD) ? fb->fd_in : fb->fd;
   #if defined(O_NONBLOCK)
   return fcntl(fd, F_SETFL, O_NONBLOCK);
  -#elif defined(F_NDELAY)
  -return fcntl(fd, F_SETFL, F_NDELAY);
  +#elif defined(O_NDELAY)
  +return fcntl(fd, F_SETFL, O_NDELAY);
  +#elif defined(FNDELAY)
  +return fcntl(fd, F_SETFL, FNDELAY);
   #else
   /* : this breaks things, but an alternative isn't obvious...*/
   return 0;
  
  
  


cvs commit: apache-1.3/src/main buff.c

1998-07-01 Thread dgaudet
dgaudet 98/07/01 11:18:27

  Modified:src  CHANGES
   src/main buff.c
  Log:
  It's definately wrong to start ap_bprintf() on a connection that's got an
  error, or one which is not buffered.
  
  It's wrong for ap_bflush() to return 0 when B_EOUT is set -- B_EOUT can
  be set by timeout(), and it seems pointless for code everywhere to have
  to test for B_EOUT when they can simply test for a ap_bflush() failure.
  
  Revision  ChangesPath
  1.943 +4 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.942
  retrieving revision 1.943
  diff -u -r1.942 -r1.943
  --- CHANGES   1998/07/01 01:37:27 1.942
  +++ CHANGES   1998/07/01 18:18:23 1.943
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.1
   
  +  *) The ap_bprintf() code neglected to test if there was an error on
  + the connection.  ap_bflush() misdiagnosed a failure as a success.
  + [Dean Gaudet]
  +
 *) add support for #perl arg interpolation in mod_include
[Doug MacEachern]
   
  
  
  
  1.78  +8 -1  apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- buff.c1998/06/04 19:58:57 1.77
  +++ buff.c1998/07/01 18:18:25 1.78
  @@ -1193,6 +1193,7 @@
   static char *cbuf = NULL;
   static int csize = 0;
   
  +/* XXX: martin don't you want to do this after the error tests below? */
   if (bgetflag(fb, B_EBCDIC2ASCII)) {
   if (nbyte > csize) {
   if (cbuf != NULL)
  @@ -1362,7 +1363,7 @@
   int ret;
   
   if (!(fb->flags & B_WR) || (fb->flags & B_EOUT))
  - return 0;
  + return -1;
   
   if (fb->flags & B_WRERR)
return -1;
  @@ -1523,6 +1524,9 @@
   int res;
   struct bprintf_data b;
   
  +/* XXX: only works with buffered writes */
  +if ((fb->flags & (B_WRERR | B_EOUT | B_WR)) != B_WR)
  + return -1;
   b.vbuff.curpos = (char *)&fb->outbase[fb->outcnt];
   b.vbuff.endpos = (char *)&fb->outbase[fb->bufsiz];
   b.fb = fb;
  @@ -1547,6 +1551,9 @@
   struct bprintf_data b;
   int res;
   
  +/* XXX: only works with buffered writes */
  +if ((fb->flags & (B_WRERR | B_EOUT | B_WR)) != B_WR)
  + return -1;
   b.vbuff.curpos = (char *)&fb->outbase[fb->outcnt];
   b.vbuff.endpos = (char *)&fb->outbase[fb->bufsiz];
   b.fb = fb;
  
  
  


cvs commit: apache-1.3/src/main buff.c

1998-07-01 Thread dgaudet
dgaudet 98/07/01 11:22:34

  Modified:src/main buff.c
  Log:
  more efficient comparisons
  
  Revision  ChangesPath
  1.79  +2 -5  apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- buff.c1998/07/01 18:18:25 1.78
  +++ buff.c1998/07/01 18:22:33 1.79
  @@ -433,7 +433,7 @@
/* already chunking */
return;
   }
  -if (!(fb->flags & B_WR) || (fb->flags & (B_WRERR | B_EOUT))) {
  +if ((fb->flags & (B_WRERR | B_EOUT | B_WR)) != B_WR) {
/* unbuffered writes */
return;
   }
  @@ -1362,10 +1362,7 @@
   {
   int ret;
   
  -if (!(fb->flags & B_WR) || (fb->flags & B_EOUT))
  - return -1;
  -
  -if (fb->flags & B_WRERR)
  +if ((fb->flags & (B_WRERR | B_EOUT | B_WR)) != B_WR)
return -1;
   
   if (fb->flags & B_CHUNK)
  
  
  


cvs commit: apache-1.3/src/main buff.c

1998-07-04 Thread dgaudet
dgaudet 98/07/04 11:22:12

  Modified:src/main buff.c
  Log:
  fix comment pointed out by ben l.
  
  Revision  ChangesPath
  1.81  +2 -1  apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- buff.c1998/07/04 16:07:27 1.80
  +++ buff.c1998/07/04 18:22:11 1.81
  @@ -933,7 +933,8 @@
   }
   
   /*
  - * Empty the buffer after putting a single character in it
  + * output a single character.  Used by ap_bputs when the buffer
  + * is full... and so it'll cause the buffer to be flushed first.
*/
   API_EXPORT(int) ap_bflsbuf(int c, BUFF *fb)
   {
  
  
  


cvs commit: apache-1.3/src/main buff.c

1998-09-04 Thread martin
martin  98/09/04 09:47:47

  Modified:src/main buff.c
  Log:
  Move buffer allocation test behind the 'simple' tests
  
  Revision  ChangesPath
  1.82  +7 -6  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.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- buff.c1998/07/04 18:22:11 1.81
  +++ buff.c1998/09/04 16:47:46 1.82
  @@ -1193,8 +1193,14 @@
   #ifdef CHARSET_EBCDIC
   static char *cbuf = NULL;
   static int csize = 0;
  +#endif /*CHARSET_EBCDIC*/
  +
  +if (fb->flags & (B_WRERR | B_EOUT))
  + return -1;
  +if (nbyte == 0)
  + return 0;
   
  -/* XXX: martin don't you want to do this after the error tests below? */
  +#ifdef CHARSET_EBCDIC
   if (ap_bgetflag(fb, B_EBCDIC2ASCII)) {
   if (nbyte > csize) {
   if (cbuf != NULL)
  @@ -1207,11 +1213,6 @@
   buf = (cbuf) ? cbuf : buf;
   }
   #endif /*CHARSET_EBCDIC*/
  -
  -if (fb->flags & (B_WRERR | B_EOUT))
  - return -1;
  -if (nbyte == 0)
  - return 0;
   
   if (!(fb->flags & B_WR)) {
   /* unbuffered write -- have to use bcwrite since we aren't taking care
  
  
  


cvs commit: apache-1.3/src/main buff.c

1998-10-05 Thread fielding
fielding98/10/05 10:48:45

  Modified:src  CHANGES
   src/main buff.c
  Log:
  Fix a possible race condition between timed-out requests and the
  ap_bhalfduplex select that might result in an infinite loop on
  platforms that do not validate the descriptor.
  
  Revision  ChangesPath
  1.1101+4 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1100
  retrieving revision 1.1101
  diff -u -r1.1100 -r1.1101
  --- CHANGES   1998/10/04 19:05:13 1.1100
  +++ CHANGES   1998/10/05 17:48:42 1.1101
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.3
   
  +  *) Fix a possible race condition between timed-out requests and the
  + ap_bhalfduplex select that might result in an infinite loop on
  + platforms that do not validate the descriptor. [Roy Fielding]
  +
 *) Fix mod_autoindex bug where directories got a size of "0k" instead
of "-".  [Martin Plechsmid <[EMAIL PROTECTED]>, Marc Slemko]
PR#3130
  
  
  
  1.83  +12 -3 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.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- buff.c1998/09/04 16:47:46 1.82
  +++ buff.c1998/10/05 17:48:44 1.83
  @@ -562,14 +562,22 @@
   #endif
   
   
  -/* note we assume the caller has ensured that fb->fd_in <= FD_SETSIZE */
  +/* Test the descriptor and flush the output buffer if it looks like
  + * we will block on the next read.
  + *
  + * Note we assume the caller has ensured that fb->fd_in <= FD_SETSIZE
  + */
   API_EXPORT(void) ap_bhalfduplex(BUFF *fb)
   {
   int rv;
   fd_set fds;
   struct timeval tv;
   
  -if (fb->incnt > 0 || fb->outcnt == 0) {
  +/* We don't need to do anything if the connection has been closed
  + * or there is something readable in the incoming buffer
  + * or there is nothing flushable in the output buffer.
  + */
  +if (fb == NULL || fb->fd_in < 0 || fb->incnt > 0 || fb->outcnt == 0) {
return;
   }
   /* test for a block */
  @@ -579,7 +587,8 @@
tv.tv_sec = 0;
tv.tv_usec = 0;
rv = ap_select(fb->fd_in + 1, &fds, NULL, NULL, &tv);
  -} while (rv < 0 && errno == EINTR);
  +} while (rv < 0 && errno == EINTR && !(fb->flags & B_EOUT));
  +
   /* treat any error as if it would block as well */
   if (rv != 1) {
ap_bflush(fb);
  
  
  


cvs commit: apache-1.3/src/main buff.c http_protocol.c

1998-07-04 Thread ben
ben 98/07/04 09:07:28

  Modified:src  CHANGES
   src/include buff.h compat.h
   src/main buff.c http_protocol.c
  Log:
  Another missed API rename: bgetflag.
  
  Revision  ChangesPath
  1.945 +2 -2  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.944
  retrieving revision 1.945
  diff -u -r1.944 -r1.945
  --- CHANGES   1998/07/03 20:05:58 1.944
  +++ CHANGES   1998/07/04 16:07:24 1.945
  @@ -10,8 +10,8 @@
 *) add support for #perl arg interpolation in mod_include
[Doug MacEachern]
   
  -  *) API: Name changes of table_elts to ap_table_elts and is_table_empty
  - to ap_is_table_empty. [Ben Laurie]
  +  *) API: Name changes of table_elts to ap_table_elts, is_table_empty
  + to ap_is_table_empty and bgetflag to ap_bgetflag. [Ben Laurie]
   
 *) PORT: Add UnixWare 7 support
[Vadim Kostoglodoff <[EMAIL PROTECTED]>] PR#2463
  
  
  
  1.45  +1 -1  apache-1.3/src/include/buff.h
  
  Index: buff.h
  ===
  RCS file: /export/home/cvs/apache-1.3/src/include/buff.h,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- buff.h1998/05/28 22:09:46 1.44
  +++ buff.h1998/07/04 16:07:25 1.45
  @@ -153,7 +153,7 @@
   API_EXPORT(int) ap_bsetflag(BUFF *fb, int flag, int value);
   API_EXPORT(int) ap_bclose(BUFF *fb);
   
  -#define bgetflag(fb, flag)   ((fb)->flags & (flag))
  +#define ap_bgetflag(fb, flag)((fb)->flags & (flag))
   
   /* Error handling */
   API_EXPORT(void) ap_bonerror(BUFF *fb, void (*error) (BUFF *, int, void *),
  
  
  
  1.12  +1 -0  apache-1.3/src/include/compat.h
  
  Index: compat.h
  ===
  RCS file: /export/home/cvs/apache-1.3/src/include/compat.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- compat.h  1998/06/29 19:06:18 1.11
  +++ compat.h  1998/07/04 16:07:26 1.12
  @@ -44,6 +44,7 @@
   #define bflsbufap_bflsbuf
   #define bflush ap_bflush
   #define bgetc  ap_bgetc
  +#define bgetflag   ap_bgetflag
   #define bgetoptap_bgetopt
   #define bgets  ap_bgets
   #define bhalfduplexap_bhalfduplex
  
  
  
  1.80  +3 -3  apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- buff.c1998/07/01 18:22:33 1.79
  +++ buff.c1998/07/04 16:07:27 1.80
  @@ -689,7 +689,7 @@
}
i = read_with_errors(fb, buf, nbyte);
   #ifdef CHARSET_EBCDIC
  - if (i > 0 && bgetflag(fb, B_ASCII2EBCDIC))
  + if (i > 0 && ap_bgetflag(fb, B_ASCII2EBCDIC))
ascii2ebcdic(buf, buf, i);
   #endif /*CHARSET_EBCDIC*/
return i;
  @@ -728,7 +728,7 @@
   /* read directly into caller's buffer */
i = read_with_errors(fb, buf, nbyte);
   #ifdef CHARSET_EBCDIC
  - if (i > 0 && bgetflag(fb, B_ASCII2EBCDIC))
  + if (i > 0 && ap_bgetflag(fb, B_ASCII2EBCDIC))
ascii2ebcdic(buf, buf, i);
   #endif /*CHARSET_EBCDIC*/
if (i == -1) {
  @@ -1194,7 +1194,7 @@
   static int csize = 0;
   
   /* XXX: martin don't you want to do this after the error tests below? */
  -if (bgetflag(fb, B_EBCDIC2ASCII)) {
  +if (ap_bgetflag(fb, B_EBCDIC2ASCII)) {
   if (nbyte > csize) {
   if (cbuf != NULL)
   free(cbuf);
  
  
  
  1.223 +3 -3  apache-1.3/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v
  retrieving revision 1.222
  retrieving revision 1.223
  diff -u -r1.222 -r1.223
  --- http_protocol.c   1998/07/01 21:19:53 1.222
  +++ http_protocol.c   1998/07/04 16:07:27 1.223
  @@ -647,7 +647,7 @@
*/
   ap_bsetflag(conn->client, B_SAFEREAD, 1);
   while ((len = getline(l, HUGE_STRING_LEN, conn->client, 0)) <= 0) {
  -if ((len < 0) || bgetflag(conn->client, B_EOF)) {
  +if ((len < 0) || ap_bgetflag(conn->client, B_EOF)) {
   ap_bsetflag(conn->client, B_SAFEREAD, 0);
   return 0;
   }
  @@ -1050,7 +1050,7 @@
   {
   char *protocol;
   #ifdef CHARSET_EBCDIC
  -int convert = bgetflag(r->connection->client, B_EBCDIC2ASCII);
  +int convert = ap_bgetflag(r->connection->client, B_EBCDIC2ASCII);
   #endif /*CHARSET_EBCDIC*/
   
   if (r->assbackwards)
  @@ -1209,7 +12

cvs commit: apache-1.3/src/main buff.c http_config.c http_main.c util.c

1999-02-20 Thread jim
jim 99/02/20 10:12:37

  Modified:.STATUS
   src  CHANGES
   src/main buff.c http_config.c http_main.c util.c
  Log:
  Added informative error messages when malloc()
  fails... some of these most probably should also exit :/
  
  Revision  ChangesPath
  1.629 +1 -5  apache-1.3/STATUS
  
  Index: STATUS
  ===
  RCS file: /export/home/cvs/apache-1.3/STATUS,v
  retrieving revision 1.628
  retrieving revision 1.629
  diff -u -r1.628 -r1.629
  --- STATUS1999/02/20 17:57:50 1.628
  +++ STATUS1999/02/20 18:12:31 1.629
  @@ -1,5 +1,5 @@
 1.3 STATUS:
  -  Last modified at [$Date: 1999/02/20 17:57:50 $]
  +  Last modified at [$Date: 1999/02/20 18:12:31 $]
   
   Release:
   
  @@ -62,10 +62,6 @@
 Allows use of C-style backslash escapes in mod_log_config format 
strings
   MID: <[EMAIL PROTECTED]>
   Status: 
  -
  -* John Bley's [PATCH] malloc checks
  -MID: <[EMAIL PROTECTED]>
  -Status: Jim -0 (maybe the messages could be more detailed?)
   
   * Ralf's [PATCH] Shared Memory Pools
   Message-ID: <[EMAIL PROTECTED]>
  
  
  
  1.1256+3 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1255
  retrieving revision 1.1256
  diff -u -r1.1255 -r1.1256
  --- CHANGES   1999/02/20 17:57:51 1.1255
  +++ CHANGES   1999/02/20 18:12:32 1.1256
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3.5
   
  +  *) Added some informative error messages for some failed malloc()
  + calls. [John Bley <[EMAIL PROTECTED]>, Jim Jagielski]
  +
 *) OS/2 ap_os_canonical_filename()'s behaviour is improved: ap_assert()
is removed. This allows  directives to work and
prevents invalid requests from killing the process.
  
  
  
  1.86  +3 -1  apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- buff.c1999/01/01 19:04:47 1.85
  +++ buff.c1999/02/20 18:12:34 1.86
  @@ -1233,8 +1233,10 @@
   if (cbuf != NULL)
   free(cbuf);
   cbuf = malloc(csize = nbyte+HUGE_STRING_LEN);
  -if (cbuf == NULL)
  +if (cbuf == NULL) {
  +fprintf(stderr, "Ouch!  Out of memory in ap_bwrite()!\n");
   csize = 0;
  +}
   }
   ebcdic2ascii((cbuf) ? cbuf : (void*)buf, buf, nbyte);
   buf = (cbuf) ? cbuf : buf;
  
  
  
  1.141 +6 -0  apache-1.3/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/http_config.c,v
  retrieving revision 1.140
  retrieving revision 1.141
  diff -u -r1.140 -r1.141
  --- http_config.c 1999/01/01 19:04:48 1.140
  +++ http_config.c 1999/02/20 18:12:35 1.141
  @@ -327,6 +327,9 @@
}
   }
   method_ptrs = malloc((how_many_ptrs + NMETHODS) * sizeof(handler_func));
  +if (method_ptrs == NULL) {
  + fprintf(stderr, "Ouch!  Out of memory in build_method_shortcuts()!\n");
  +}
   next_ptr = 0;
   for (i = 0; i < NMETHODS; ++i) {
/* XXX: This is an itsy bit presumptuous about the alignment
  @@ -693,6 +696,9 @@
*/
   ap_loaded_modules = (module **)malloc(
   sizeof(module *)*(total_modules+DYNAMIC_MODULE_LIMIT+1));
  +if (ap_loaded_modules == NULL) {
  + fprintf(stderr, "Ouch!  Out of memory in 
ap_setup_prelinked_modules()!\n");
  +}
   for (m = ap_preloaded_modules, m2 = ap_loaded_modules; *m != NULL; )
   *m2++ = *m++;
   *m2 = NULL;
  
  
  
  1.423 +9 -0  apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.422
  retrieving revision 1.423
  diff -u -r1.422 -r1.423
  --- http_main.c   1999/02/09 13:18:19 1.422
  +++ http_main.c   1999/02/20 18:12:35 1.423
  @@ -1544,6 +1544,9 @@
   {
   ap_assert(!ap_scoreboard_image);
   ap_scoreboard_image = (scoreboard *) malloc(SCOREBOARD_SIZE);
  +if (ap_scoreboard_image == NULL) {
  + fprintf(stderr, "Ouch!  Out of memory reiniting scoreboard!\n");
  +}
   memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE);
   }
   
  @@ -4809,6 +4812,9 @@
   /* TODO: If too many jobs in queue, sleep, check for problems */
   ap_acquire_mutex(allowed_globals.jobmutex);
   new_job = (joblist *) malloc(sizeof(joblist));
  +if (new_jobs == NULL) {
  + fprintf(stde