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

2000-01-11 Thread martin
martin  00/01/11 07:51:33

  Modified:src  CHANGES
   src/main buff.c
  Log:
  Thanks a lot to Dean for his chunked-code regression test! Sorry I found
  this so late, apparently browsers swallowed it.
  The trailing CRLF in the last chunk was not converted.
  
  Revision  ChangesPath
  1.1493+3 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1492
  retrieving revision 1.1493
  diff -u -r1.1492 -r1.1493
  --- CHANGES   2000/01/11 14:22:59 1.1492
  +++ CHANGES   2000/01/11 15:51:29 1.1493
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3.10
   
  +  *) The end_chunk() code forgot to convert the trailing CRLF pair
  + from EBCDIC to ASCII. Fixed. [Martin Kraemer]
  +
 *) An Action set for a Location that didn't correspond to a file didn't
work. Fixed.
[Manoj Kasichainula, Ben Laurie]
  
  
  
  1.94  +6 -4  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.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- buff.c1999/12/09 12:05:03 1.93
  +++ buff.c2000/01/11 15:51:32 1.94
  @@ -542,14 +542,16 @@
   }
   *strp++ = CR;
   *strp = LF;
  -#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], 
CHUNK_HEADER_SIZE);
  -#endif /*CHARSET_EBCDIC*/
   
   /* tack on the trailing CRLF, we've reserved room for this */
   fb-outbase[fb-outcnt++] = CR;
   fb-outbase[fb-outcnt++] = LF;
  +
  +#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], 
CHUNK_HEADER_SIZE);
  +ebcdic2ascii(fb-outbase[fb-outcnt-2], fb-outbase[fb-outcnt-2], 2);
  +#endif /*CHARSET_EBCDIC*/
   
   fb-outchunk = -1;
   }
  
  
  


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

1999-12-01 Thread martin
martin  99/12/01 12:24:58

  Modified:src  CHANGES
   src/main buff.c
  Log:
  On BS2000, currently the send() call has slightly better performance
  than write(), and it doesn't have a maximum transfer size of 16kB.
  
  Revision  ChangesPath
  1.1464+4 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1463
  retrieving revision 1.1464
  diff -u -r1.1463 -r1.1464
  --- CHANGES   1999/11/30 15:51:59 1.1463
  +++ CHANGES   1999/12/01 20:24:50 1.1464
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.10
   
  +  *) BS2000: Use send() instead of write() in the core buff routines
  + for better performance and fewer restrictions (max. transfer size)
  + [Martin Kraemer]
  +
 *) If the compiler sanity check fails, force the verbose output
for TestCompile so people can have a clue what the problem
is. [Jim Jagielski]
  
  
  
  1.91  +11 -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.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- buff.c1999/10/22 05:10:06 1.90
  +++ buff.c1999/12/01 20:24:56 1.91
  @@ -319,6 +319,17 @@
   #if defined (B_SFIO)
rv = sfwrite(fb-sf_out, buf, nbyte);
   #else
  +#ifdef _OSD_POSIX
  +/* Sorry, but this is a hack: On BS2000, currently the send() call
  + * has slightly better performance, and it doesn't have a maximum
  +  * transfer size of 16kB per write. Both write() and writev()
  +  * currently have such a limit and therefore don't work
  +  * too well with MMAP files.
  +  */
  + if (fb-flags  B_SOCKET)
  + rv = send(fb-fd, buf, nbyte, 0);
  + else
  +#endif
rv = write(fb-fd, buf, nbyte);
   #endif
   
  
  
  


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

1999-10-22 Thread stoddard
stoddard99/10/21 22:10:09

  Modified:src/main buff.c
  Log:
  Apache for Windows can get caught in a tight loop whild handling CGI 
requests. Here's how:
  sendwithtimeout() sets  errno to EINTR on a timeout and returns SOCKET_ERROR 
(-1) to
  the caller. The caller reissues sendwithtimeout, which then succeeds. errno 
is left set to
  EINTR. Eventually,  another read is attempted on one of the CGI pipes 
(ap_bgets in mod_cgi,
  or ap_send_fb_length) which goes down into ap_read. ap_read issues a Win32 
ReadFile to read
  from the pipe. If this read fails, it returns -1 to the caller. If errno
  is still set to EINTR, the caller will retry the read and so the loop begins.
  
  The solution is quite simple. buff.c relies heavily on errno. Anytime Win32 
calls are used
  in code that uses errno, we need to always, ALWAYS explicitly set errno when 
a Win32 system
  call fails (via either errno = GetLastError() or errno = WSAGetLastError()). 
Since Win32
  does not use EINTR, this problem should not occur.
  
  PR: 3599 3971 4245 4430 4758 5171
  Submitted by: Thanks to [EMAIL PROTECTED] who discovered the loopig section of
  code.
  
  Revision  ChangesPath
  1.90  +19 -15apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- buff.c1999/10/21 20:44:32 1.89
  +++ buff.c1999/10/22 05:10:06 1.90
  @@ -172,12 +172,12 @@

retry=1;
   #ifdef NETWARE
  -ap_log_error(APLOG_MARK,APLOG_DEBUG,NULL,
  - select claimed we could write, but in fact 
we couldn't.);
  - ThreadSwitchWithDelay();
  +ap_log_error(APLOG_MARK,APLOG_DEBUG,NULL,
  + select claimed we could write, but 
in fact we couldn't.);
  +ThreadSwitchWithDelay();
   #else
  -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.);
  +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.);
Sleep(100);
   #endif
}
  @@ -250,8 +250,10 @@
   
   #ifdef WIN32
   if (fb-hFH != INVALID_HANDLE_VALUE) {
  -if (!ReadFile(fb-hFH,buf,nbyte,rv,NULL))
  +if (!ReadFile(fb-hFH,buf,nbyte,rv,NULL)) {
  +errno = GetLastError();
   rv = -1;
  +}
   }
   else
   #endif
  @@ -274,9 +276,9 @@
rv = ap_read(fb, buf, nbyte);
   #elif defined (BEOS)
   if (fb-flags  B_SOCKET) {
  -rv = recv(fb-fd_in, buf, nbyte, 0);
  +rv = recv(fb-fd_in, buf, nbyte, 0);
   } else
  -rv = ap_read(fb,buf,nbyte);
  +rv = ap_read(fb,buf,nbyte);
   #elif defined(TPF)
   fd_set fds;
   struct timeval tv;
  @@ -293,7 +295,7 @@
   rv = ap_read(fb, buf, nbyte);
   }
   else
  -rv = ap_read(fb, buf, nbyte);
  +rv = ap_read(fb, buf, nbyte);
   #else
   rv = ap_read(fb, buf, nbyte);
   #endif /* WIN32 */
  @@ -307,8 +309,10 @@
   
   #ifdef WIN32
   if (fb-hFH != INVALID_HANDLE_VALUE) {
  -if (!WriteFile(fb-hFH,buf,nbyte,rv,NULL))
  -  rv = -1;
  +if (!WriteFile(fb-hFH,buf,nbyte,rv,NULL)) {
  +errno = GetLastError();
  +rv = -1;
  +}
   }
   else
   #endif
  @@ -335,9 +339,9 @@
rv = ap_write(fb, buf, nbyte);
   #elif defined(BEOS)
   if(fb-flags  B_SOCKET) {
  -rv = send(fb-fd, buf, nbyte, 0);
  +rv = send(fb-fd, buf, nbyte, 0);
   } else 
  -rv = ap_write(fb, buf,nbyte);
  +rv = ap_write(fb, buf,nbyte);
   #else
   rv = ap_write(fb, buf, nbyte);
   #endif /* WIN32 */
  @@ -1457,8 +1461,8 @@
   }
   #ifndef NETWARE
   else if (fb-hFH != INVALID_HANDLE_VALUE) {
  - rc2 = ap_pcloseh(fb-pool, fb-hFH);
  - rc3 = 0;
  +rc2 = ap_pcloseh(fb-pool, fb-hFH);
  +rc3 = 0;
   }
   #endif
   else {
  
  
  


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

1999-07-29 Thread randy
randy   99/07/29 11:13:58

  Modified:.config.layout
   src  CHANGES
   src/include httpd.h
   src/main buff.c http_main.c util.c
  Log:
  BeOS portability changes.
  Submitted by: David Reid [EMAIL PROTECTED]
  Reviewed by:  Randy Terbush
  
  Revision  ChangesPath
  1.10  +21 -0 apache-1.3/config.layout
  
  Index: config.layout
  ===
  RCS file: /home/cvs/apache-1.3/config.layout,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- config.layout 1999/06/27 04:42:40 1.9
  +++ config.layout 1999/07/29 18:12:43 1.10
  @@ -129,3 +129,24 @@
   logfiledir:$localstatedir/logs
   proxycachedir: $localstatedir/proxy
   /Layout
  +
  +#  BeOS layout...
  +Layout beos
  +prefix:/boot/home/apache
  +exec_prefix:   $prefix
  +bindir:$exec_prefix/bin
  +sbindir:   $exec_prefix/bin
  +libexecdir:$exec_prefix/libexec
  +mandir:$prefix/man
  +sysconfdir:$prefix/conf
  +datadir:   $prefix
  +iconsdir:  $datadir/icons
  +htdocsdir: $datadir/htdocs
  +cgidir:$datadir/cgi-bin
  +includedir:$prefix/include
  +localstatedir: $prefix
  +runtimedir:$localstatedir/logs
  +logfiledir:$localstatedir/logs
  +proxycachedir: $localstatedir/proxy
  +/Layout
  +
  
  
  
  1.1402+9 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1401
  retrieving revision 1.1402
  diff -u -r1.1401 -r1.1402
  --- CHANGES   1999/07/29 17:53:45 1.1401
  +++ CHANGES   1999/07/29 18:13:10 1.1402
  @@ -1,5 +1,14 @@
   Changes with Apache 1.3.7
   
  +  *) Portability changes for BeOS. [David Reid [EMAIL PROTECTED]
  +
  +  *) Sanitise Vary values by not adding duplicate keywords.  A
  + separate routine needs to be used to do this, so any module
  + that frobs Vary needs to be changed.  The standard modules
  + have all been modified.  This solution is somewhat inelegant,
  + but it does the job for now.  PR#4118 (better fix than before)
  + [Ken Coar, Roy Fielding]
  +
 *) Link DSO's with gcc -shared instead of ld -Bshareable at 
least on Linux and FreeBSD for now.  
[Rasmus Lerdorf]
  
  
  
  1.286 +2 -0  apache-1.3/src/include/httpd.h
  
  Index: httpd.h
  ===
  RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v
  retrieving revision 1.285
  retrieving revision 1.286
  diff -u -r1.285 -r1.286
  --- httpd.h   1999/07/19 09:48:24 1.285
  +++ httpd.h   1999/07/29 18:13:30 1.286
  @@ -85,6 +85,8 @@
   #elif defined(WIN32)
   /* Set default for Windows file system */
   #define HTTPD_ROOT /apache
  +#elif defined(BEOS)
  +#define HTTPD_ROOT /boot/home/apache
   #else
   #define HTTPD_ROOT /usr/local/apache
   #endif
  
  
  
  1.88  +22 -1 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.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- buff.c1999/04/27 20:36:30 1.87
  +++ buff.c1999/07/29 18:13:40 1.88
  @@ -259,6 +259,11 @@
   }
   else
rv = ap_read(fb, buf, nbyte);
  +#elif defined (BEOS)
  +if (fb-flags  B_SOCKET) {
  +rv = recv(fb-fd_in, buf, nbyte, 0);
  +} else
  +rv = ap_read(fb,buf,nbyte);
   #elif defined(TPF)
   fd_set fds;
   struct timeval tv;
  @@ -315,6 +320,11 @@
   }
   else
rv = ap_write(fb, buf, nbyte);
  +#elif defined(BEOS)
  +if(fb-flags  B_SOCKET) {
  +rv = send(fb-fd, buf, nbyte, 0);
  +} else 
  +rv = ap_write(fb, buf,nbyte);
   #else
   rv = ap_write(fb, buf, nbyte);
   #endif /* WIN32 */
  @@ -681,6 +691,7 @@
   return rv;
   }
   
  +
   /*
* Read up to nbyte bytes into buf.
* If fewer than byte bytes are currently available, then return those.
  @@ -1436,6 +1447,16 @@
rc3 = 0;
   }
   else {
  +#elif defined(BEOS)
  +if (fb-flags  B_SOCKET) {
  + rc2 = ap_pclosesocket(fb-pool, fb-fd);
  + if (fb-fd_in != fb-fd) {
  + rc3 = ap_pclosesocket(fb-pool, fb-fd_in);
  + }
  + else {
  + rc3 = 0;
  + }
  +} else {
   #endif
rc2 = ap_pclosef(fb-pool, fb-fd);
if (fb-fd_in != fb-fd) {
  @@ -1444,7 +1465,7 @@
else {
rc3 = 0;
}
  -#ifdef WIN32
  +#if defined(WIN32) || defined (BEOS)
   }
   #endif
   
  
  
  
  1.465 +25 -0 apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===
  RCS file: 

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 Directory proxy:* 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) {
  + 

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

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 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 +1209,7 @@
   int i;
   

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-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-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-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-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-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-outchunk], fb-outbase[fb-outchunk], 
CHUNK_HEADER_SIZE);
   

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 http://www.apache.org/.
   *
   */
  
  #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 copyright
   *