From: Greg Stein Date: Sat, 17 Jun 2000 01:29:29 +0000 (+0000) Subject: ap_bvputs() is a misnomer; introduce ap_bputstrs() X-Git-Tag: APACHE_2_0_ALPHA_5~323 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7d0508e8af35dd5bbe667700cda69f005621488;p=apache ap_bvputs() is a misnomer; introduce ap_bputstrs() [todo: proxy and file_cache code should be updated for new name] add ap_vbputstrs() use ap_vbputstrs() from http_protocol. use EOF in a few places, rather than the magic "-1" constant git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85589 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 10a788fb70..1299e70047 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -2460,7 +2460,7 @@ API_EXPORT(int) ap_vrprintf(request_rec *r, const char *fmt, va_list ap) int n; if (r->connection->aborted) - return -1; + return EOF; n = ap_vbprintf(r->connection->client, fmt, ap); @@ -2472,7 +2472,7 @@ API_EXPORT(int) ap_vrprintf(request_rec *r, const char *fmt, va_list ap) ap_bsetflag(r->connection->client, B_EOUT, 1); r->connection->aborted = 1; } - return -1; + return EOF; } SET_BYTES_SENT(r); return n; @@ -2484,7 +2484,7 @@ API_EXPORT(int) ap_rprintf(request_rec *r, const char *fmt,...) int n; if (r->connection->aborted) - return -1; + return EOF; va_start(vlist, fmt); n = ap_vbprintf(r->connection->client, fmt, vlist); @@ -2498,7 +2498,7 @@ API_EXPORT(int) ap_rprintf(request_rec *r, const char *fmt,...) ap_bsetflag(r->connection->client, B_EOUT, 1); r->connection->aborted = 1; } - return -1; + return EOF; } SET_BYTES_SENT(r); return n; @@ -2507,38 +2507,28 @@ API_EXPORT(int) ap_rprintf(request_rec *r, const char *fmt,...) API_EXPORT_NONSTD(int) ap_rvputs(request_rec *r,...) { va_list args; - ap_ssize_t i; - int j, k; - const char *x; - BUFF *fb = r->connection->client; - ap_status_t rv; + int n; if (r->connection->aborted) return EOF; va_start(args, r); - for (k = 0;;) { - x = va_arg(args, const char *); - if (x == NULL) - break; - j = strlen(x); - rv = ap_bwrite(fb, x, j, &i); - if (i != j) { - va_end(args); - if (!r->connection->aborted) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, rv, r, - "client stopped connection before rvputs completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - } - return EOF; + n = ap_vbputstrs(r->connection->client, args); + va_end(args); + + if (n < 0) { + if (!r->connection->aborted) { + ap_log_rerror(APLOG_MARK, APLOG_INFO, + ap_berror(r->connection->client), r, + "client stopped connection before rvputs completed"); + ap_bsetflag(r->connection->client, B_EOUT, 1); + r->connection->aborted = 1; } - k += i; + return EOF; } - va_end(args); SET_BYTES_SENT(r); - return k; + return n; } API_EXPORT(int) ap_rflush(request_rec *r)