diff options
Diffstat (limited to 'buckets')
-rw-r--r-- | buckets/ap_buckets.c | 4 | ||||
-rw-r--r-- | buckets/ap_buckets_heap.c | 3 | ||||
-rw-r--r-- | buckets/ap_buckets_pipe.c | 25 | ||||
-rw-r--r-- | buckets/apr_buckets.c | 4 | ||||
-rw-r--r-- | buckets/apr_buckets_heap.c | 3 | ||||
-rw-r--r-- | buckets/apr_buckets_pipe.c | 25 |
6 files changed, 30 insertions, 34 deletions
diff --git a/buckets/ap_buckets.c b/buckets/ap_buckets.c index c53c2044..656fdb07 100644 --- a/buckets/ap_buckets.c +++ b/buckets/ap_buckets.c @@ -208,11 +208,11 @@ API_EXPORT(int) ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_lis */ char buf[4096]; ap_bucket *r; - int res, i; + int res; res = apr_vsnprintf(buf, 4096, fmt, va); - r = ap_bucket_create_heap(buf, strlen(buf), 1, &i); + r = ap_bucket_create_heap(buf, strlen(buf), 1, NULL); ap_brigade_append_buckets(b, r); return res; diff --git a/buckets/ap_buckets_heap.c b/buckets/ap_buckets_heap.c index c8fc48f0..29e3c57f 100644 --- a/buckets/ap_buckets_heap.c +++ b/buckets/ap_buckets_heap.c @@ -133,7 +133,8 @@ API_EXPORT(ap_bucket *) ap_bucket_make_heap(ap_bucket *b, b->read = heap_read; b->setaside = NULL; - *w = length; + if (w) + *w = length; return b; } diff --git a/buckets/ap_buckets_pipe.c b/buckets/ap_buckets_pipe.c index ab827e22..8e0d08ac 100644 --- a/buckets/ap_buckets_pipe.c +++ b/buckets/ap_buckets_pipe.c @@ -67,31 +67,28 @@ static apr_status_t pipe_split(ap_bucket *a, apr_off_t point) } /* Ignore the block arg for now. We can fix that tomorrow. */ -static apr_status_t pipe_read(ap_bucket *b, const char **str, +static apr_status_t pipe_read(ap_bucket *b, const char **str, apr_ssize_t *len, int block) { ap_bucket_pipe *bd = b->data; ap_bucket *a; - apr_size_t l; - apr_ssize_t toss; - char buf[IOBUFSIZE]; + char *buf; apr_status_t rv; + /* + * XXX: We need to obey the block flag + */ + buf = malloc(IOBUFSIZE); + *str = buf; *len = IOBUFSIZE; if ((rv = apr_read(bd->thepipe, buf, len)) != APR_SUCCESS) { + free(buf); return rv; } - if (*len > 0) { - l = *len; + if (len > 0) { a = ap_bucket_create_pipe(bd->thepipe); - - /* XXX ap_bucket_make_heap() can decide not to copy all our data; - * either handle it here or ensure that IOBUFSIZE < - * DEFAULT_BUCKET_SIZE; - */ - b = ap_bucket_make_heap(b, buf, l, 1, &toss); - b->read(b, str, len, block); /* set str to new location of data */ - + b = ap_bucket_make_heap(b, buf, *len, 0, NULL); + if (b->next) { b->next->prev = a; } diff --git a/buckets/apr_buckets.c b/buckets/apr_buckets.c index c53c2044..656fdb07 100644 --- a/buckets/apr_buckets.c +++ b/buckets/apr_buckets.c @@ -208,11 +208,11 @@ API_EXPORT(int) ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_lis */ char buf[4096]; ap_bucket *r; - int res, i; + int res; res = apr_vsnprintf(buf, 4096, fmt, va); - r = ap_bucket_create_heap(buf, strlen(buf), 1, &i); + r = ap_bucket_create_heap(buf, strlen(buf), 1, NULL); ap_brigade_append_buckets(b, r); return res; diff --git a/buckets/apr_buckets_heap.c b/buckets/apr_buckets_heap.c index c8fc48f0..29e3c57f 100644 --- a/buckets/apr_buckets_heap.c +++ b/buckets/apr_buckets_heap.c @@ -133,7 +133,8 @@ API_EXPORT(ap_bucket *) ap_bucket_make_heap(ap_bucket *b, b->read = heap_read; b->setaside = NULL; - *w = length; + if (w) + *w = length; return b; } diff --git a/buckets/apr_buckets_pipe.c b/buckets/apr_buckets_pipe.c index ab827e22..8e0d08ac 100644 --- a/buckets/apr_buckets_pipe.c +++ b/buckets/apr_buckets_pipe.c @@ -67,31 +67,28 @@ static apr_status_t pipe_split(ap_bucket *a, apr_off_t point) } /* Ignore the block arg for now. We can fix that tomorrow. */ -static apr_status_t pipe_read(ap_bucket *b, const char **str, +static apr_status_t pipe_read(ap_bucket *b, const char **str, apr_ssize_t *len, int block) { ap_bucket_pipe *bd = b->data; ap_bucket *a; - apr_size_t l; - apr_ssize_t toss; - char buf[IOBUFSIZE]; + char *buf; apr_status_t rv; + /* + * XXX: We need to obey the block flag + */ + buf = malloc(IOBUFSIZE); + *str = buf; *len = IOBUFSIZE; if ((rv = apr_read(bd->thepipe, buf, len)) != APR_SUCCESS) { + free(buf); return rv; } - if (*len > 0) { - l = *len; + if (len > 0) { a = ap_bucket_create_pipe(bd->thepipe); - - /* XXX ap_bucket_make_heap() can decide not to copy all our data; - * either handle it here or ensure that IOBUFSIZE < - * DEFAULT_BUCKET_SIZE; - */ - b = ap_bucket_make_heap(b, buf, l, 1, &toss); - b->read(b, str, len, block); /* set str to new location of data */ - + b = ap_bucket_make_heap(b, buf, *len, 0, NULL); + if (b->next) { b->next->prev = a; } |