1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Compiler warnings - yuck!

Moved ap_proxy_string_read() to proxy_util.c so it can be used by
proxy_http.c
PR:
Obtained from:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88777 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Graham Leggett
2001-04-10 00:13:56 +00:00
parent d881b12d74
commit 10c533558e
3 changed files with 54 additions and 74 deletions

View File

@@ -1081,6 +1081,55 @@ int ap_proxy_pre_http_connection(conn_rec *c, request_rec *r)
return OK;
}
/* converts a series of buckets into a string */
apr_status_t ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buff, size_t bufflen)
{
apr_bucket *e;
apr_status_t rv;
char *pos = buff;
char *response;
int found = 0;
size_t len;
/* start with an empty string */
buff[0] = 0;
/* get line-at-a-time */
c->remain = 0;
/* loop through each brigade */
while (!found) {
/* get brigade from network */
if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb, AP_MODE_BLOCKING))) {
return rv;
}
/* loop through each bucket */
while (!found && !APR_BRIGADE_EMPTY(bb)) {
e = APR_BRIGADE_FIRST(bb);
if (APR_SUCCESS != apr_bucket_read(e, (const char **)&response, &len, APR_BLOCK_READ)) {
return rv;
}
/* is string LF terminated? */
if (memchr(response, APR_ASCII_LF, len)) {
found = 1;
}
/* concat strings until buff is full - then throw the data away */
if (len > ((bufflen-1)-(pos-buff))) {
len = (bufflen-1)-(pos-buff);
}
if (len > 0) {
pos = apr_cpystrn(pos, response, len);
}
APR_BUCKET_REMOVE(e);
apr_bucket_destroy(e);
}
}
return APR_SUCCESS;
}
#if defined WIN32