manoj 99/06/03 16:46:28
Modified: pthreads/src CHANGES
pthreads/src/include buff.h http_main.h
pthreads/src/main buff.c http_main.c http_protocol.c
util_script.c
pthreads/src/modules/proxy proxy_cache.c proxy_ftp.c
proxy_http.c proxy_util.c
pthreads/src/modules/standard mod_cgi.c mod_mime_magic.c
Log:
Replace the existing timeout-setting mechanism. Now, instead of passing
a timeout interval to every buff call, we set the timeout value for each
buff once using bsetopt().
Revision Changes Path
1.7 +4 -7 apache-apr/pthreads/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/CHANGES,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- CHANGES 1999/04/12 15:06:23 1.6
+++ CHANGES 1999/06/03 23:46:19 1.7
@@ -1,4 +1,8 @@
Changes with Apache apr
+ *) New buff option added: BO_TIMEOUT. It describes the timeout for
+ buff operations (generally over a network). [Dean Gaudet, Ryan
+ Bloom, Manoj Kasichainula]
+
*) Created http_accept abstraction. Added 4 new functions (not exported):
init_accept(), begin_accepting_requests(), get_request(),
stop_accepting_requests() [Bill Stoddard [EMAIL PROTECTED]
@@ -8,13 +12,6 @@
*) user and ap_auth_type fields were moved from connection_rec to
request_rec. [Ryan Bloom [EMAIL PROTECTED]
-
- *) Argument added to ap_bgets, ap_bwrite, buff_read, buff_write, saferead,
- read_with_errors, write_it_all, write_with_errors, bcwrite. This
argument
- is the seconds argument, if zero the call blocks and trys to read or
write
- the data until an error occurs, or until it is successful. If non-zero,
- the call reads or writes for n seconds, or until it is successful. [Ryan
- Bloom [EMAIL PROTECTED]
*) Sendwithtimeout and recvwithtimeout calls added to non-Windows
platforms.
This brings the code path closer together for all platforms. [Ryan Bloom
1.5 +3 -2 apache-apr/pthreads/src/include/buff.h
Index: buff.h
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/include/buff.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- buff.h 1999/04/09 04:10:35 1.4
+++ buff.h 1999/06/03 23:46:21 1.5
@@ -120,6 +120,7 @@
#ifdef WIN32
HANDLE hFH; /* Windows filehandle */
#endif
+ time_t timeout; /* timeout for B_SOCKET operations */
/* transport handle, for RPC binding handle or some such */
void *t_handle;
@@ -165,10 +166,10 @@
/* I/O */
API_EXPORT(int) ap_bread(BUFF *fb, void *buf, int nbyte);
-API_EXPORT(int) ap_bgets(char *s, int n, BUFF *fb, time_t sec);
+API_EXPORT(int) ap_bgets(char *s, int n, BUFF *fb);
API_EXPORT(int) ap_blookc(char *buff, BUFF *fb);
API_EXPORT(int) ap_bskiplf(BUFF *fb);
-API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte, time_t sec);
+API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte);
API_EXPORT(int) ap_bflush(BUFF *fb);
API_EXPORT(int) ap_bputs(const char *x, BUFF *fb);
API_EXPORT(int) ap_bvputs(BUFF *fb,...);
1.7 +0 -1 apache-apr/pthreads/src/include/http_main.h
Index: http_main.h
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/include/http_main.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- http_main.h 1999/05/24 02:10:25 1.6
+++ http_main.h 1999/06/03 23:46:21 1.7
@@ -120,7 +120,6 @@
void ap_start_shutdown(void);
void ap_start_restart(int);
void ap_keepalive_timeout(char *, request_rec *);
-int ap_get_timeout(request_rec *r);
API_EXPORT(void) ap_child_terminate(request_rec *r);
int ap_update_child_status(int child_num, int thread_num, int status,
request_rec *r);
1.11 +48 -39 apache-apr/pthreads/src/main/buff.c
Index: buff.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -u -r1.10 -r1.11
--- buff.c 1999/06/03 23:37:44 1.10
+++ buff.c 1999/06/03 23:46:22 1.11
@@ -236,10 +236,11 @@
fb->outcnt = 0;
fb->outchunk = -1;
fb->error = NULL;
- fb->bytes_sent = 0L;
+ fb->bytes_sent = 0;
fb->fd = -1;
fb->fd_in = -1;
+ fb->timeout = -1;
#ifdef B_SFIO
fb->sf_in = NULL;
@@ -264,29 +265,37 @@
API_EXPORT(int) ap_bsetopt(BUFF *fb, int optname, const void *optval)
{
- if (optname == BO_BYTECT) {
+ switch (optname) {
+ case BO_BYTECT:
fb->bytes_sent = *(const long int *) optval - (long int) fb->outcnt;;
return 0;
- }
- else {
- errno = EINVAL;
- return -1;
+
+ case BO_TIMEOUT:
+ fb->timeout = *(time_t *)optval;
+ return 0;
}
+ errno = EINVAL;
+ return -1;
}
API_EXPORT(int) ap_bgetopt(BUFF *fb, int optname, void *optval)
{
- if (optname == BO_BYTECT) {
- long int bs = fb->bytes_sent + fb->outcnt;
+ long int bs;
+
+ switch (optname) {
+ case BO_BYTECT:
+ bs = fb->bytes_sent + fb->outcnt;
if (bs < 0L)
bs = 0L;
*(long int *) optval = bs;
return 0;
- }
- else {
- errno = EINVAL;
- return -1;
+
+ case BO_TIMEOUT:
+ *(time_t *)optval = fb->timeout;
+ return 0;
}
+ errno = EINVAL;
+ return -1;
}
static int bflush_core(BUFF *fb);
@@ -450,7 +459,7 @@
#if !defined (B_SFIO)
#define saferead saferead_guts
#else
-static int saferead(BUFF *fb, char *buf, int nbyte, time_t sec)
+static int saferead(BUFF *fb, char *buf, int nbyte)
{
return sfread(fb->sf_in, buf, nbyte);
}
@@ -490,7 +499,7 @@
}
}
-static ap_inline int saferead_guts(BUFF *fb, void *buf, int nbyte, time_t
sec)
+static ap_inline int saferead_guts(BUFF *fb, void *buf, int nbyte)
{
int rv;
@@ -498,7 +507,7 @@
ap_bhalfduplex(fb);
}
do {
- rv = recvwithtimeout(fb->fd_in, buf, nbyte, sec);
+ rv = recvwithtimeout(fb->fd_in, buf, nbyte, fb->timeout);
} while (rv == -1 && errno == EINTR && !(fb->flags & B_EOUT));
return (rv);
}
@@ -545,11 +554,11 @@
* and then there's the SFIO case. Note that saferead takes care
* of EINTR.
*/
-static int read_with_errors(BUFF *fb, void *buf, int nbyte, time_t sec)
+static int read_with_errors(BUFF *fb, void *buf, int nbyte)
{
int rv;
- rv = saferead(fb, buf, nbyte, sec);
+ rv = saferead(fb, buf, nbyte);
if (rv == 0) {
fb->flags |= B_EOF;
}
@@ -591,7 +600,7 @@
fb->inptr += i;
return i;
}
- i = read_with_errors(fb, buf, nbyte, 0);
+ i = read_with_errors(fb, buf, nbyte);
#ifdef CHARSET_EBCDIC
if (i > 0 && ap_bgetflag(fb, B_ASCII2EBCDIC))
ascii2ebcdic(buf, buf, i);
@@ -630,7 +639,7 @@
/* do a single read */
if (nbyte >= fb->bufsiz) {
/* read directly into caller's buffer */
- i = read_with_errors(fb, buf, nbyte, 0);
+ i = read_with_errors(fb, buf, nbyte);
#ifdef CHARSET_EBCDIC
if (i > 0 && ap_bgetflag(fb, B_ASCII2EBCDIC))
ascii2ebcdic(buf, buf, i);
@@ -642,7 +651,7 @@
else {
/* read into hold buffer, then memcpy */
fb->inptr = fb->inbase;
- i = read_with_errors(fb, fb->inptr, fb->bufsiz, 0);
+ i = read_with_errors(fb, fb->inptr, fb->bufsiz);
if (i == -1) {
return nrd ? nrd : -1;
}
@@ -680,7 +689,7 @@
* CR characters in the byte stream not immediately followed by a LF
* will be preserved.
*/
-API_EXPORT(int) ap_bgets(char *buff, int n, BUFF *fb, time_t sec)
+API_EXPORT(int) ap_bgets(char *buff, int n, BUFF *fb)
{
int i, ch, ct;
@@ -701,7 +710,7 @@
fb->incnt = 0;
if (fb->flags & B_EOF)
break;
- i = read_with_errors(fb, fb->inptr, fb->bufsiz, sec);
+ i = read_with_errors(fb, fb->inptr, fb->bufsiz);
if (i == -1) {
buff[ct] = '\0';
return ct ? ct : -1;
@@ -782,7 +791,7 @@
if (fb->flags & B_EOF)
return 0;
- i = read_with_errors(fb, fb->inptr, fb->bufsiz, 0);
+ i = read_with_errors(fb, fb->inptr, fb->bufsiz);
if (i <= 0) {
return i;
}
@@ -829,7 +838,7 @@
fb->incnt = 0;
if (fb->flags & B_EOF)
return 0;
- i = read_with_errors(fb, fb->inptr, fb->bufsiz, 0);
+ i = read_with_errors(fb, fb->inptr, fb->bufsiz);
if (i <= 0)
return i;
fb->incnt = i;
@@ -845,7 +854,7 @@
char ss[1];
ss[0] = c;
- return ap_bwrite(fb, ss, 1, 0);
+ return ap_bwrite(fb, ss, 1);
}
/*
@@ -875,7 +884,7 @@
*
* Deals with calling doerror and setting bytes_sent.
*/
-static int write_it_all(BUFF *fb, const void *buf, int nbyte, time_t sec)
+static int write_it_all(BUFF *fb, const void *buf, int nbyte)
{
int i;
@@ -883,7 +892,7 @@
return -1;
while (nbyte > 0) {
- i = sendwithtimeout(fb->fd, buf, nbyte, sec);
+ i = sendwithtimeout(fb->fd, buf, nbyte, fb->timeout);
if (i < 0) {
if (errno != EAGAIN && errno != EINTR) {
doerror(fb, B_WR);
@@ -951,12 +960,12 @@
/* A wrapper for sendwithtimeout which deals with error conditions and
* bytes_sent. Also handles non-blocking writes.
*/
-static int write_with_errors(BUFF *fb, const void *buf, int nbyte, time_t
sec)
+static int write_with_errors(BUFF *fb, const void *buf, int nbyte)
{
int rv;
do
- rv = sendwithtimeout(fb->fd, buf, nbyte, sec);
+ rv = sendwithtimeout(fb->fd, buf, nbyte, fb->timeout);
while (rv == -1 && errno == EINTR && !(fb->flags & B_EOUT));
if (rv == -1) {
if (errno != EAGAIN) {
@@ -982,7 +991,7 @@
* Can be used on non-blocking descriptors, but only if they're not chunked.
* Deals with doerror() and bytes_sent.
*/
-static int bcwrite(BUFF *fb, const void *buf, int nbyte, time_t sec)
+static int bcwrite(BUFF *fb, const void *buf, int nbyte)
{
char chunksize[16]; /* Big enough for practically anything
*/
#ifndef NO_WRITEV
@@ -993,7 +1002,7 @@
return -1;
if (!(fb->flags & B_CHUNK)) {
- return write_with_errors(fb, buf, nbyte, sec);
+ return write_with_errors(fb, buf, nbyte);
}
#ifdef NO_WRITEV
@@ -1091,7 +1100,7 @@
* It is worth noting that if an error occurs, the buffer is in an unknown
* state.
*/
-API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte, time_t sec)
+API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte)
{
int i, nwr, useable_bufsiz;
#ifdef CHARSET_EBCDIC
@@ -1123,7 +1132,7 @@
if (!(fb->flags & B_WR)) {
/* unbuffered write -- have to use bcwrite since we aren't taking care
* of chunking any other way */
- return bcwrite(fb, buf, nbyte, sec);
+ return bcwrite(fb, buf, nbyte);
}
#ifndef NO_WRITEV
@@ -1166,14 +1175,14 @@
/* it is just too painful to try to re-cram the buffer while
* chunking
*/
- if (write_it_all(fb, fb->outbase, fb->outcnt, 0) == -1) {
+ if (write_it_all(fb, fb->outbase, fb->outcnt) == -1) {
/* we cannot continue after a chunked error */
return -1;
}
fb->outcnt = 0;
break;
}
- i = write_with_errors(fb, fb->outbase, fb->outcnt, 0);
+ i = write_with_errors(fb, fb->outbase, fb->outcnt);
if (i <= 0) {
return nwr ? nwr : -1;
}
@@ -1207,7 +1216,7 @@
useable_bufsiz = fb->bufsiz;
if (fb->flags & B_CHUNK) useable_bufsiz -= CHUNK_HEADER_SIZE;
while (nbyte >= useable_bufsiz) {
- i = bcwrite(fb, buf, nbyte, 0);
+ i = bcwrite(fb, buf, nbyte);
if (i <= 0) {
return nwr ? nwr : -1;
}
@@ -1236,7 +1245,7 @@
int i;
while (fb->outcnt > 0) {
- i = write_with_errors(fb, fb->outbase, fb->outcnt, 0);
+ i = write_with_errors(fb, fb->outbase, fb->outcnt);
if (i <= 0)
return -1;
@@ -1334,7 +1343,7 @@
API_EXPORT(int) ap_bputs(const char *x, BUFF *fb)
{
int i, j = strlen(x);
- i = ap_bwrite(fb, x, j, 0);
+ i = ap_bwrite(fb, x, j);
if (i != j)
return -1;
else
@@ -1356,7 +1365,7 @@
if (x == NULL)
break;
j = strlen(x);
- i = ap_bwrite(fb, x, j, 0);
+ i = ap_bwrite(fb, x, j);
if (i != j) {
va_end(v);
return -1;
1.89 +0 -11 apache-apr/pthreads/src/main/http_main.c
Index: http_main.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -u -r1.88 -r1.89
--- http_main.c 1999/05/26 07:12:30 1.88
+++ http_main.c 1999/06/03 23:46:23 1.89
@@ -361,17 +361,6 @@
exit(code);
}
-int ap_get_timeout(request_rec *r)
-{
-
- if (r->connection->keptalive) {
- return(r->server->keep_alive_timeout);
- }
- else {
- return(r->server->timeout);
- }
-}
-
static void usage(char *bin)
{
char pad[MAX_STRING_LEN];
1.17 +20 -11 apache-apr/pthreads/src/main/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -u -r1.16 -r1.17
--- http_protocol.c 1999/04/09 04:10:37 1.16
+++ http_protocol.c 1999/06/03 23:46:23 1.17
@@ -668,7 +668,7 @@
* then the actual input line exceeded the buffer length,
* and it would be a good idea for the caller to puke 400 or 414.
*/
-static int getline(char *s, int n, BUFF *in, int fold, time_t sec)
+static int getline(char *s, int n, BUFF *in, int fold)
{
char *pos, next;
int retval;
@@ -677,7 +677,7 @@
pos = s;
do {
- retval = ap_bgets(pos, n, in, sec);
+ retval = ap_bgets(pos, n, in);
/* retval == -1 if error, 0 if EOF */
if (retval <= 0)
@@ -798,7 +798,7 @@
* have to block during a read.
*/
ap_bsetflag(conn->client, B_SAFEREAD, 1);
- while ((len = getline(l, sizeof(l), conn->client, 0, ap_get_timeout(r)))
<= 0) {
+ while ((len = getline(l, sizeof(l), conn->client, 0)) <= 0) {
if ((len < 0) || ap_bgetflag(conn->client, B_EOF)) {
ap_bsetflag(conn->client, B_SAFEREAD, 0);
return 0;
@@ -873,7 +873,7 @@
* Read header lines until we get the empty separator line, a read error,
* the connection closes (EOF), reach the server limit, or we timeout.
*/
- while ((len = getline(field, sizeof(field), c->client, 1, 0)) > 0) {
+ while ((len = getline(field, sizeof(field), c->client, 1)) > 0) {
if (r->server->limit_req_fields &&
(++fields_read > r->server->limit_req_fields)) {
@@ -957,6 +957,11 @@
ap_bsetflag(r->connection->client, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 1);
#endif
+ ap_bsetopt(conn->client, BO_TIMEOUT,
+ conn->keptalive
+ ? &r->server->keep_alive_timeout
+ : &r->server->timeout);
+
/* Get the request... */
if (!read_request_line(r)) {
if (r->status == HTTP_REQUEST_URI_TOO_LARGE) {
@@ -969,6 +974,10 @@
}
return NULL;
}
+ if (r->connection->keptalive) {
+ ap_bsetopt(r->connection->client, BO_TIMEOUT,
+ &r->server->timeout);
+ }
if (!r->assbackwards) {
get_mime_headers(r);
if (r->status != HTTP_REQUEST_TIME_OUT) {
@@ -1739,7 +1748,7 @@
if (r->remaining == 0) { /* Start of new chunk */
- chunk_start = getline(buffer, bufsiz, r->connection->client, 0, 0);
+ chunk_start = getline(buffer, bufsiz, r->connection->client, 0);
if ((chunk_start <= 0) || (chunk_start >= (bufsiz - 1))
|| !ap_isxdigit(*buffer)) {
r->connection->keepalive = -1;
@@ -1780,7 +1789,7 @@
len_read = chunk_start;
while ((bufsiz > 1) && ((len_read =
- getline(buffer, bufsiz, r->connection->client, 1, 0)) >
0)) {
+ getline(buffer, bufsiz, r->connection->client, 1)) > 0)) {
if (len_read != (bufsiz - 1)) {
buffer[len_read++] = CR; /* Restore footer line end
*/
@@ -1911,7 +1920,7 @@
o = 0;
while (n && !ap_is_aborted(r->connection)) {
- w = ap_bwrite(r->connection->client, &buf[o], n, 0);
+ w = ap_bwrite(r->connection->client, &buf[o], n);
if (w > 0) {
total_bytes_sent += w;
n -= w;
@@ -2022,7 +2031,7 @@
o = 0;
while (n && !ap_is_aborted(r->connection)) {
- w = ap_bwrite(r->connection->client, &buf[o], n, 0);
+ w = ap_bwrite(r->connection->client, &buf[o], n);
if (w > 0) {
total_bytes_sent += w;
n -= w;
@@ -2080,7 +2089,7 @@
}
while (n && !r->connection->aborted) {
- w = ap_bwrite(r->connection->client, (char *) mm + offset, n, 0);
+ w = ap_bwrite(r->connection->client, (char *) mm + offset, n);
if (w > 0) {
total_bytes_sent += w;
n -= w;
@@ -2152,7 +2161,7 @@
if (r->connection->aborted)
return -1;
- n = ap_bwrite(r->connection->client, buf, nbyte, 0);
+ n = ap_bwrite(r->connection->client, buf, nbyte);
if (n < 0) {
if (!r->connection->aborted) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
@@ -2207,7 +2216,7 @@
if (x == NULL)
break;
j = strlen(x);
- i = ap_bwrite(fb, x, j, 0);
+ i = ap_bwrite(fb, x, j);
if (i != j) {
va_end(args);
if (!r->connection->aborted) {
1.6 +1 -1 apache-apr/pthreads/src/main/util_script.c
Index: util_script.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/util_script.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -u -r1.5 -r1.6
--- util_script.c 1999/03/24 18:39:47 1.5
+++ util_script.c 1999/06/03 23:46:23 1.6
@@ -611,7 +611,7 @@
static int getsfunc_BUFF(char *w, int len, void *fb)
{
- return ap_bgets(w, len, (BUFF *) fb, 0) > 0;
+ return ap_bgets(w, len, (BUFF *) fb) > 0;
}
API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *fb,
1.8 +3 -3 apache-apr/pthreads/src/modules/proxy/proxy_cache.c
Index: proxy_cache.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/proxy/proxy_cache.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -u -r1.7 -r1.8
--- proxy_cache.c 1999/05/30 23:48:59 1.7
+++ proxy_cache.c 1999/06/03 23:46:25 1.8
@@ -537,7 +537,7 @@
* date SP lastmod SP expire SP count SP content-length CRLF
* dates are stored as hex seconds since 1970
*/
- len = ap_bgets(urlbuff, sizeof urlbuff, cachefp, 0);
+ len = ap_bgets(urlbuff, sizeof urlbuff, cachefp);
if (len == -1)
return -1;
if (len == 0 || urlbuff[len - 1] != '\n')
@@ -555,7 +555,7 @@
c->len = ap_proxy_hex2sec(urlbuff + 36);
/* check that we have the same URL */
- len = ap_bgets(urlbuff, sizeof urlbuff, cachefp, 0);
+ len = ap_bgets(urlbuff, sizeof urlbuff, cachefp);
if (len == -1)
return -1;
if (len == 0 || strncmp(urlbuff, "X-URL: ", 7) != 0 ||
@@ -566,7 +566,7 @@
return 0;
/* What follows is the message */
- len = ap_bgets(urlbuff, sizeof urlbuff, cachefp, 0);
+ len = ap_bgets(urlbuff, sizeof urlbuff, cachefp);
if (len == -1)
return -1;
if (len == 0 || urlbuff[len - 1] != '\n')
1.7 +8 -8 apache-apr/pthreads/src/modules/proxy/proxy_ftp.c
Index: proxy_ftp.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/proxy/proxy_ftp.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- proxy_ftp.c 1999/03/24 18:39:49 1.6
+++ proxy_ftp.c 1999/06/03 23:46:25 1.7
@@ -193,7 +193,7 @@
int len, status;
char linebuff[100], buff[5];
- len = ap_bgets(linebuff, sizeof linebuff, f, 0);
+ len = ap_bgets(linebuff, sizeof linebuff, f);
if (len == -1)
return -1;
/* check format */
@@ -212,7 +212,7 @@
memcpy(buff, linebuff, 3);
buff[3] = ' ';
do {
- len = ap_bgets(linebuff, sizeof linebuff, f, 0);
+ len = ap_bgets(linebuff, sizeof linebuff, f);
if (len == -1)
return -1;
if (linebuff[len - 1] != '\n') {
@@ -235,7 +235,7 @@
char *mb = msgbuf,
*me = &msgbuf[msglen];
- len = ap_bgets(linebuff, sizeof linebuff, f, 0);
+ len = ap_bgets(linebuff, sizeof linebuff, f);
if (len == -1)
return -1;
if (len < 5 || !ap_isdigit(linebuff[0]) || !ap_isdigit(linebuff[1]) ||
@@ -253,7 +253,7 @@
memcpy(buff, linebuff, 3);
buff[3] = ' ';
do {
- len = ap_bgets(linebuff, sizeof linebuff, f, 0);
+ len = ap_bgets(linebuff, sizeof linebuff, f);
if (len == -1)
return -1;
if (linebuff[len - 1] != '\n') {
@@ -320,7 +320,7 @@
total_bytes_sent += ap_proxy_bputs2(buf, con->client, c);
while (!con->aborted) {
- n = ap_bgets(buf, sizeof buf, f, 0);
+ n = ap_bgets(buf, sizeof buf, f);
if (n == -1) { /* input error */
if (c != NULL)
c = ap_proxy_cache_error(c);
@@ -382,11 +382,11 @@
o = 0;
total_bytes_sent += n;
- if (c != NULL && c->fp && ap_bwrite(c->fp, buf, n, 0) != n)
+ if (c != NULL && c->fp && ap_bwrite(c->fp, buf, n) != n)
c = ap_proxy_cache_error(c);
while (n && !r->connection->aborted) {
- w = ap_bwrite(con->client, &buf[o], n, 0);
+ w = ap_bwrite(con->client, &buf[o], n);
if (w <= 0)
break;
n -= w;
@@ -807,7 +807,7 @@
/* 501 Syntax error in parameters or arguments. */
/* 502 Command not implemented. */
/* 530 Not logged in. */
- i = ap_bgets(pasv, sizeof(pasv), f, 0);
+ i = ap_bgets(pasv, sizeof(pasv), f);
if (i == -1) {
ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r,
"PASV: control connection is toast");
1.5 +4 -4 apache-apr/pthreads/src/modules/proxy/proxy_http.c
Index: proxy_http.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/proxy/proxy_http.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- proxy_http.c 1999/03/17 17:01:44 1.4
+++ proxy_http.c 1999/06/03 23:46:25 1.5
@@ -355,11 +355,11 @@
if (ap_should_client_block(r)) {
while ((i = ap_get_client_block(r, buffer, sizeof buffer)) > 0)
- ap_bwrite(f, buffer, i, 0);
+ ap_bwrite(f, buffer, i);
}
ap_bflush(f);
- len = ap_bgets(buffer, sizeof buffer - 1, f, 0);
+ len = ap_bgets(buffer, sizeof buffer - 1, f);
if (len == -1 || len == 0) {
ap_bclose(f);
ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
@@ -488,8 +488,8 @@
r->sent_bodyct = 1;
/* Is it an HTTP/0.9 respose? If so, send the extra data */
if (backasswards) {
- ap_bwrite(r->connection->client, buffer, len, 0);
- if (c != NULL && c->fp != NULL && ap_bwrite(c->fp, buffer, len, 0) !=
len)
+ ap_bwrite(r->connection->client, buffer, len);
+ if (c != NULL && c->fp != NULL && ap_bwrite(c->fp, buffer, len) != len)
c = ap_proxy_cache_error(c);
}
1.6 +3 -3 apache-apr/pthreads/src/modules/proxy/proxy_util.c
Index: proxy_util.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/proxy/proxy_util.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -u -r1.5 -r1.6
--- proxy_util.c 1999/05/30 23:48:59 1.5
+++ proxy_util.c 1999/06/03 23:46:25 1.6
@@ -391,7 +391,7 @@
pos = s;
do {
- retval = ap_bgets(pos, n, in, 0); /* retval == -1 if error, 0 if
EOF */
+ retval = ap_bgets(pos, n, in); /* retval == -1 if error, 0 if
EOF */
if (retval <= 0)
return ((retval < 0) && (total == 0)) ? -1 : total;
@@ -552,7 +552,7 @@
/* Write to cache first. */
/*@@@ XXX FIXME: Assuming that writing the cache file won't time
out?!!? */
if (c != NULL && c->fp != NULL) {
- if (ap_bwrite(c->fp, &buf[0], n, 0) != n) {
+ if (ap_bwrite(c->fp, &buf[0], n) != n) {
c = ap_proxy_cache_error(c);
} else {
c->written += n;
@@ -561,7 +561,7 @@
/* Write the block to the client, detect aborted transfers */
while (!con->aborted && n > 0) {
- w = ap_bwrite(con->client, &buf[o], n, 0);
+ w = ap_bwrite(con->client, &buf[o], n);
if (w <= 0) {
if (c != NULL && c->fp != NULL) {
1.5 +10 -10 apache-apr/pthreads/src/modules/standard/mod_cgi.c
Index: mod_cgi.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_cgi.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- mod_cgi.c 1999/03/17 17:01:51 1.4
+++ mod_cgi.c 1999/06/03 23:46:27 1.5
@@ -208,9 +208,9 @@
((f = ap_pfopen(r->pool, ap_server_root_relative(r->pool,
conf->logname),
"a")) == NULL)) {
/* Soak up script output */
- while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in, 0) > 0)
+ while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0)
continue;
- while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err, 0) > 0)
+ while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0)
continue;
return ret;
}
@@ -245,18 +245,18 @@
if (sbuf && *sbuf)
fprintf(f, "%s\n", sbuf);
- if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in, 0) > 0) {
+ if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) {
fputs("%stdout\n", f);
fputs(argsbuffer, f);
- while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in, 0) > 0)
+ while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0)
fputs(argsbuffer, f);
fputs("\n", f);
}
- if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err, 0) > 0) {
+ if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) {
fputs("%stderr\n", f);
fputs(argsbuffer, f);
- while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err, 0) > 0)
+ while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0)
fputs(argsbuffer, f);
fputs("\n", f);
}
@@ -463,7 +463,7 @@
memcpy(dbuf + dbpos, argsbuffer, dbsize);
dbpos += dbsize;
}
- if (ap_bwrite(script_out, argsbuffer, len_read, 0) < len_read) {
+ if (ap_bwrite(script_out, argsbuffer, len_read) < len_read) {
/* silly script stopped reading, soak up remaining message */
while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN) > 0)
{
/* dump it */
@@ -498,10 +498,10 @@
if (location && location[0] == '/' && r->status == 200) {
/* Soak up all the script output */
- while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in, 0) > 0) {
+ while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) {
continue;
}
- while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err, 0) > 0) {
+ while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) {
continue;
}
/* This redirect needs to be a GET no matter what the original
@@ -532,7 +532,7 @@
}
ap_bclose(script_in);
- while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err, 0) > 0) {
+ while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) {
continue;
}
ap_bclose(script_err);
1.7 +1 -1 apache-apr/pthreads/src/modules/standard/mod_mime_magic.c
Index: mod_mime_magic.c
===================================================================
RCS file:
/home/cvs/apache-apr/pthreads/src/modules/standard/mod_mime_magic.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- mod_mime_magic.c 1999/03/15 14:26:55 1.6
+++ mod_mime_magic.c 1999/06/03 23:46:27 1.7
@@ -2178,7 +2178,7 @@
return -1;
}
- if (ap_bwrite(bin, old, n, 0) != n) {
+ if (ap_bwrite(bin, old, n) != n) {
ap_destroy_pool(sub_pool);
ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
MODNAME ": write failed.");