Mailing List Archive

cvs commit: apache-2.0/src/include ap_buckets.h
rbb 00/08/23 21:17:46

Modified: src/ap Makefile.in
src/include ap_buckets.h
Added: src/ap ap_buckets_pipe.c
Log:
This is a first pass at a pipe bucket type. This compiles, but it is
untested.

Revision Changes Path
1.7 +1 -1 apache-2.0/src/ap/Makefile.in

Index: Makefile.in
===================================================================
RCS file: /home/cvs/apache-2.0/src/ap/Makefile.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Makefile.in 2000/08/19 06:04:51 1.6
+++ Makefile.in 2000/08/24 04:17:44 1.7
@@ -2,6 +2,6 @@
LTLIBRARY_NAME = libap.la
LTLIBRARY_SOURCES = ap_cache.c ap_base64.c ap_sha1.c ap_hooks.c ap_buckets.c \
ap_buckets_eos.c ap_buckets_simple.c ap_buckets_refcount.c \
- ap_buckets_heap.c ap_buckets_mmap.c
+ ap_buckets_heap.c ap_buckets_mmap.c ap_buckets_pipe.c

include $(top_srcdir)/build/ltlib.mk



1.1 apache-2.0/src/ap/ap_buckets_pipe.c

Index: ap_buckets_pipe.c
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/

#include "apr_private.h"
#include "httpd.h"
#include "ap_buckets.h"
#include <stdlib.h>

static apr_status_t pipe_split(ap_bucket *a, apr_off_t point)
{
/* Splitting a pipe doesn't really make any sense, because as we read
* it becomes a heap bucket. I am leaving this in because I may be wrong,
* but it just returns an error, and I expect it to go away immediately
*/
return APR_ENOTIMPL;
}

/* Ignore the block arg for now. We can fix that tomorrow. */
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];

apr_read(bd->thepipe, buf, len);
l = *len;
ap_memcpy(str, buf, len);
a = ap_bucket_create_heap(buf, l, 0, &toss);

a->prev = b->prev;
b->prev->next = a;
a->next = b;
b->prev = a;

return APR_SUCCESS;
}

API_EXPORT(ap_bucket *) ap_bucket_make_pipe(ap_bucket *b, apr_file_t *thispipe)
{
ap_bucket_pipe *bd;

bd = malloc(sizeof(*bd));
if (bd == NULL) {
return NULL;
}
bd->thepipe = thispipe;

b->type = AP_BUCKET_PIPE;
b->length = -1;
b->setaside = NULL;
b->destroy = free;
b->split = NULL;
b->read = pipe_read;
b->data = bd;

return b;
}

API_EXPORT(ap_bucket *) ap_bucket_create_pipe(apr_file_t *thispipe)
{
ap_bucket_do_create(ap_bucket_make_pipe(b, thispipe));
}



1.15 +9 -0 apache-2.0/src/include/ap_buckets.h

Index: ap_buckets.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/include/ap_buckets.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ap_buckets.h 2000/08/22 03:20:45 1.14
+++ ap_buckets.h 2000/08/24 04:17:45 1.15
@@ -551,4 +551,13 @@
API_EXPORT(ap_bucket *) ap_bucket_make_mmap(ap_bucket *b,
apr_mmap_t *mm, apr_off_t start, apr_size_t length);

+/**
+ * Create a bucket referring to a pipe.
+ * @param thispipe The pipe to put in the bucket
+ * @return The new bucket, or NULL if allocation failed
+ * @deffunc ap_bucket *ap_bucket_create_pipe(apr_file_t *thispipe)
+ */
+API_EXPORT(ap_bucket *) ap_bucket_create_pipe(apr_file_t *thispipe);
+API_EXPORT(ap_bucket *) ap_bucket_make_pipe(ap_bucket *b, apr_file_t *thispipe);
+
#endif
Re: cvs commit: apache-2.0/src/include ap_buckets.h [ In reply to ]
On 24 Aug 2000 rbb@locus.apache.org wrote:

> rbb 00/08/23 21:17:46
>
> Modified: src/ap Makefile.in
> src/include ap_buckets.h
> Added: src/ap ap_buckets_pipe.c
> Log:
> This is a first pass at a pipe bucket type. This compiles, but it is
> untested.

Okay, here's the deal. I wrote the pipe type. It is almost impossible to
test without really hacking on the CGI or Include modules. If nobody else
does that before I do, I will start on that tomorrow sometime. If
somebody else starts, please just let me know so I can work on something
else. :-)

Ryan

_______________________________________________________________________________
Ryan Bloom rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------