0
-static apr_status_t bucket_read(apr_bucket *a, const char **str, apr_size_t *len, apr_read_type_e block);
0
+static apr_status_t bucket_read(apr_bucket *a, const char **str, apr_size_t *len, apr_read_type_e block);
0
-static const apr_bucket_type_t apr_bucket_type_passenger_pipe = {
0
+static const apr_bucket_type_t apr_bucket_type_passenger_pipe = {
0
- apr_bucket_type_t::APR_BUCKET_DATA,
0
- apr_bucket_destroy_noop,
0
- apr_bucket_setaside_notimpl,
0
- apr_bucket_split_notimpl,
0
- apr_bucket_copy_notimpl
0
+ apr_bucket_type_t::APR_BUCKET_DATA,
0
+ apr_bucket_destroy_noop,
0
+ apr_bucket_setaside_notimpl,
0
+ apr_bucket_split_notimpl,
0
+ apr_bucket_copy_notimpl
0
-bucket_read(apr_bucket *bucket, const char **str, apr_size_t *len, apr_read_type_e block) {
0
- apr_interval_time_t timeout;
0
+bucket_read(apr_bucket *bucket, const char **str, apr_size_t *len, apr_read_type_e block) {
0
+ apr_interval_time_t timeout;
0
- pipe = (apr_file_t *) bucket->data;
0
- if (block == APR_NONBLOCK_READ) {
0
- apr_file_pipe_timeout_get(pipe, &timeout);
0
- apr_file_pipe_timeout_set(pipe, 0);
0
- *len = APR_BUCKET_BUFF_SIZE;
0
- buf = (char *) apr_bucket_alloc(*len, bucket->list); // TODO: check for failure?
0
- ret = apr_file_read(pipe, buf, len);
0
- if (block == APR_NONBLOCK_READ) {
0
- apr_file_pipe_timeout_set(pipe, timeout);
0
- if (ret != APR_SUCCESS && ret != APR_EOF) {
0
+ pipe = (apr_file_t *) bucket->data;
0
+ if (block == APR_NONBLOCK_READ) {
0
+ apr_file_pipe_timeout_get(pipe, &timeout);
0
+ apr_file_pipe_timeout_set(pipe, 0);
0
+ *len = APR_BUCKET_BUFF_SIZE;
0
+ buf = (char *) apr_bucket_alloc(*len, bucket->list); // TODO: check for failure?
0
+ ret = apr_file_read(pipe, buf, len);
0
+ if (block == APR_NONBLOCK_READ) {
0
+ apr_file_pipe_timeout_set(pipe, timeout);
0
+ if (ret != APR_SUCCESS && ret != APR_EOF) {
0
// ... we might want to set an error flag here ...
0
- * If there's more to read we have to keep the rest of the pipe
0
- /* Change the current bucket to refer to what we read */
0
- bucket = apr_bucket_heap_make(bucket, buf, *len, apr_bucket_free);
0
- h = (apr_bucket_heap *) bucket->data;
0
- h->alloc_len = APR_BUCKET_BUFF_SIZE; /* note the real buffer size */
0
- APR_BUCKET_INSERT_AFTER(bucket, passenger_bucket_create(pipe, bucket->list));
0
- bucket = apr_bucket_immortal_make(bucket, "", 0);
0
- *str = (const char *) bucket->data;
0
+ * If there's more to read we have to keep the rest of the pipe
0
+ /* Change the current bucket to refer to what we read */
0
+ bucket = apr_bucket_heap_make(bucket, buf, *len, apr_bucket_free);
0
+ h = (apr_bucket_heap *) bucket->data;
0
+ h->alloc_len = APR_BUCKET_BUFF_SIZE; /* note the real buffer size */
0
+ APR_BUCKET_INSERT_AFTER(bucket, passenger_bucket_create(pipe, bucket->list));
0
+ bucket = apr_bucket_immortal_make(bucket, "", 0);
0
+ *str = (const char *) bucket->data;
0
// if (rv != APR_EOF) {
0
// ... we might want to set an error flag here ...
0
-passenger_bucket_make(apr_bucket *bucket, apr_file_t *pipe) {
0
- bucket->type = &apr_bucket_type_passenger_pipe;
0
- bucket->length = (apr_size_t)(-1);
0
+passenger_bucket_make(apr_bucket *bucket, apr_file_t *pipe) {
0
+ bucket->type = &apr_bucket_type_passenger_pipe;
0
+ bucket->length = (apr_size_t)(-1);
0
-passenger_bucket_create(apr_file_t *pipe, apr_bucket_alloc_t *list) {
0
+passenger_bucket_create(apr_file_t *pipe, apr_bucket_alloc_t *list) {
0
- bucket = (apr_bucket *) apr_bucket_alloc(sizeof(*bucket), list);
0
- APR_BUCKET_INIT(bucket);
0
- bucket->free = apr_bucket_free;
0
- return passenger_bucket_make(bucket, pipe);
0
+ bucket = (apr_bucket *) apr_bucket_alloc(sizeof(*bucket), list);
0
+ APR_BUCKET_INIT(bucket);
0
+ bucket->free = apr_bucket_free;
0
+ return passenger_bucket_make(bucket, pipe);
Comments
No one has commented yet.