mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Change ap_bread's interface to no longer require errno.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84073 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -39,7 +39,8 @@ static int process_echo_connection(conn_rec *c)
|
|||||||
for( ; ; )
|
for( ; ; )
|
||||||
{
|
{
|
||||||
int w;
|
int w;
|
||||||
int r=ap_bread(c->client,buf,sizeof buf);
|
int r;
|
||||||
|
(void) ap_bread(c->client,buf,sizeof buf,&r);
|
||||||
if(r <= 0)
|
if(r <= 0)
|
||||||
break;
|
break;
|
||||||
w=ap_bwrite(c->client,buf,r);
|
w=ap_bwrite(c->client,buf,r);
|
||||||
|
@@ -1813,17 +1813,21 @@ static long get_chunk_size(char *b)
|
|||||||
API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz)
|
API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
long len_read, len_to_read;
|
ap_size_t len_to_read;
|
||||||
|
ap_ssize_t len_read;
|
||||||
long chunk_start = 0;
|
long chunk_start = 0;
|
||||||
unsigned long max_body;
|
unsigned long max_body;
|
||||||
|
ap_status_t rv;
|
||||||
|
|
||||||
if (!r->read_chunked) { /* Content-length read */
|
if (!r->read_chunked) { /* Content-length read */
|
||||||
len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining;
|
len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining;
|
||||||
len_read = ap_bread(r->connection->client, buffer, len_to_read);
|
rv = ap_bread(r->connection->client, buffer, len_to_read, &len_read);
|
||||||
if (len_read <= 0) {
|
if (len_read == 0) { /* error or eof */
|
||||||
if (len_read < 0)
|
if (rv != APR_SUCCESS) {
|
||||||
r->connection->keepalive = -1;
|
r->connection->keepalive = -1;
|
||||||
return len_read;
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
r->read_length += len_read;
|
r->read_length += len_read;
|
||||||
r->remaining -= len_read;
|
r->remaining -= len_read;
|
||||||
@@ -1931,8 +1935,8 @@ API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz)
|
|||||||
|
|
||||||
len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining;
|
len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining;
|
||||||
|
|
||||||
len_read = ap_bread(r->connection->client, buffer, len_to_read);
|
(void) ap_bread(r->connection->client, buffer, len_to_read, &len_read);
|
||||||
if (len_read <= 0) {
|
if (len_read == 0) { /* error or eof */
|
||||||
r->connection->keepalive = -1;
|
r->connection->keepalive = -1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -2072,7 +2076,9 @@ API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length)
|
|||||||
char buf[IOBUFSIZE];
|
char buf[IOBUFSIZE];
|
||||||
long total_bytes_sent = 0;
|
long total_bytes_sent = 0;
|
||||||
long zero_timeout = 0;
|
long zero_timeout = 0;
|
||||||
int n, w, o;
|
int w, o;
|
||||||
|
ap_ssize_t n;
|
||||||
|
ap_status_t rv;
|
||||||
|
|
||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2085,13 +2091,13 @@ API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length)
|
|||||||
|
|
||||||
ap_bsetopt(fb, BO_TIMEOUT, &zero_timeout);
|
ap_bsetopt(fb, BO_TIMEOUT, &zero_timeout);
|
||||||
while (!ap_is_aborted(r->connection)) {
|
while (!ap_is_aborted(r->connection)) {
|
||||||
n = ap_bread(fb, buf, sizeof(buf));
|
rv = ap_bread(fb, buf, sizeof(buf), &n);
|
||||||
if (n <= 0) {
|
if (n == 0) {
|
||||||
if (n == 0) {
|
if (rv == APR_SUCCESS) { /* eof */
|
||||||
(void) ap_rflush(r);
|
(void) ap_rflush(r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (n == -1 && errno != EAGAIN) {
|
if (rv != APR_EAGAIN) {
|
||||||
r->connection->aborted = 1;
|
r->connection->aborted = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2101,9 +2107,9 @@ API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ap_bsetopt(fb, BO_TIMEOUT, &r->server->timeout);
|
ap_bsetopt(fb, BO_TIMEOUT, &r->server->timeout);
|
||||||
n = ap_bread(fb, buf, sizeof(buf));
|
rv = ap_bread(fb, buf, sizeof(buf), &n);
|
||||||
if (n <= 0) {
|
if (n == 0) {
|
||||||
if (n == 0) {
|
if (rv == APR_SUCCESS) { /* eof */
|
||||||
(void) ap_rflush(r);
|
(void) ap_rflush(r);
|
||||||
}
|
}
|
||||||
r->connection->aborted = 1;
|
r->connection->aborted = 1;
|
||||||
|
@@ -2173,6 +2173,7 @@ static int uncompress(request_rec *r, int method,
|
|||||||
struct uncompress_parms parm;
|
struct uncompress_parms parm;
|
||||||
BUFF *bout;
|
BUFF *bout;
|
||||||
ap_context_t *sub_pool;
|
ap_context_t *sub_pool;
|
||||||
|
ap_status_t rv;
|
||||||
|
|
||||||
parm.r = r;
|
parm.r = r;
|
||||||
parm.method = method;
|
parm.method = method;
|
||||||
@@ -2192,9 +2193,10 @@ static int uncompress(request_rec *r, int method,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*newch = (unsigned char *) ap_palloc(r->pool, n);
|
*newch = (unsigned char *) ap_palloc(r->pool, n);
|
||||||
if ((n = ap_bread(bout, *newch, n)) <= 0) {
|
rv = ap_bread(bout, *newch, n, &n);
|
||||||
|
if (n == 0) {
|
||||||
ap_destroy_pool(sub_pool);
|
ap_destroy_pool(sub_pool);
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
MODNAME ": read failed %s", r->filename);
|
MODNAME ": read failed %s", r->filename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user