Skip to content

Commit

Permalink
Gary Bensons filter patch
Browse files Browse the repository at this point in the history
  • Loading branch information
gtrubetskoy committed Jul 16, 2002
1 parent 0848ce5 commit 9853b80
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
10 changes: 5 additions & 5 deletions src/filterobject.c
Expand Up @@ -44,7 +44,7 @@
*
* filterobject.c
*
* $Id: filterobject.c,v 1.5 2002/06/03 14:31:15 gtrubetskoy Exp $
* $Id: filterobject.c,v 1.6 2002/07/16 18:06:03 gtrubetskoy Exp $
*
* See accompanying documentation and source code comments
* for details.
Expand All @@ -61,7 +61,7 @@
*/

PyObject *MpFilter_FromFilter(ap_filter_t *f, apr_bucket_brigade *bb, int is_input,
ap_input_mode_t mode, apr_size_t *readbytes,
ap_input_mode_t mode, apr_size_t readbytes,
char * handler, char *dir)
{
filterobject *result;
Expand All @@ -86,7 +86,7 @@ PyObject *MpFilter_FromFilter(ap_filter_t *f, apr_bucket_brigade *bb, int is_inp
result->bb_in = bb;
result->bb_out = NULL;
result->mode = 0;
result->readbytes = NULL;
result->readbytes = 0;
}

result->closed = 0;
Expand Down Expand Up @@ -142,7 +142,7 @@ static PyObject *_filter_read(filterobject *self, PyObject *args, int readline)

Py_BEGIN_ALLOW_THREADS;
self->rc = ap_get_brigade(self->f->next, self->bb_in, self->mode,
APR_BLOCK_READ, *self->readbytes);
APR_BLOCK_READ, self->readbytes);
Py_END_ALLOW_THREADS;

if (! APR_STATUS_IS_SUCCESS(self->rc)) {
Expand Down Expand Up @@ -239,7 +239,7 @@ static PyObject *_filter_read(filterobject *self, PyObject *args, int readline)

Py_BEGIN_ALLOW_THREADS;
self->rc = ap_get_brigade(self->f->next, self->bb_in, self->mode,
APR_BLOCK_READ, *self->readbytes);
APR_BLOCK_READ, self->readbytes);
Py_END_ALLOW_THREADS;

if (! APR_STATUS_IS_SUCCESS(self->rc)) {
Expand Down
6 changes: 3 additions & 3 deletions src/include/filterobject.h
Expand Up @@ -44,7 +44,7 @@
*
* filterobject.h
*
* $Id: filterobject.h,v 1.4 2002/06/03 14:31:16 gtrubetskoy Exp $
* $Id: filterobject.h,v 1.5 2002/07/16 18:06:07 gtrubetskoy Exp $
*
*/

Expand All @@ -67,7 +67,7 @@ extern "C" {

int is_input;
ap_input_mode_t mode;
apr_size_t *readbytes;
apr_size_t readbytes;

int closed;
int softspace;
Expand All @@ -88,7 +88,7 @@ extern "C" {
extern DL_IMPORT(PyObject *)
MpFilter_FromFilter Py_PROTO((ap_filter_t *f, apr_bucket_brigade *bb_in,
int is_input, ap_input_mode_t mode,
apr_size_t *readbytes, char *hadler, char *dir));
apr_size_t readbytes, char *hadler, char *dir));

#ifdef __cplusplus
}
Expand Down
25 changes: 11 additions & 14 deletions src/mod_python.c
Expand Up @@ -44,7 +44,7 @@
*
* mod_python.c
*
* $Id: mod_python.c,v 1.60 2002/06/03 14:31:15 gtrubetskoy Exp $
* $Id: mod_python.c,v 1.61 2002/07/16 18:06:05 gtrubetskoy Exp $
*
* See accompanying documentation and source code comments
* for details.
Expand Down Expand Up @@ -258,7 +258,7 @@ apr_status_t python_cleanup(void *data)
/**
** python_init()
**
* Called at Apache mod_python initialization time.
* Called by Apache at mod_python initialization time.
*/

static int python_init(apr_pool_t *p, apr_pool_t *ptemp,
Expand Down Expand Up @@ -1023,7 +1023,8 @@ static apr_status_t python_cleanup_handler(void *data)
static apr_status_t python_filter(int is_input, ap_filter_t *f,
apr_bucket_brigade *bb,
ap_input_mode_t mode,
apr_size_t *readbytes) {
apr_read_type_e block,
apr_size_t readbytes) {

PyObject *resultobject = NULL;
interpreterdata *idata;
Expand All @@ -1036,6 +1037,8 @@ static apr_status_t python_filter(int is_input, ap_filter_t *f,
python_filter_ctx *ctx;
py_filter_handler *fh;

return APR_SUCCESS;

/* we only allow request level filters so far */
req = f->r;

Expand All @@ -1052,8 +1055,7 @@ static apr_status_t python_filter(int is_input, ap_filter_t *f,
so a fitler can spit out an error without causing infinite loop */
if (ctx->transparent) {
if (is_input)
return ap_get_brigade(f->next, bb, mode, APR_BLOCK_READ,
*readbytes);
return ap_get_brigade(f->next, bb, mode, block, readbytes);
else
return ap_pass_brigade(f->next, bb);
}
Expand Down Expand Up @@ -1182,12 +1184,6 @@ static apr_status_t python_filter(int is_input, ap_filter_t *f,
}
return filter->rc;







return APR_SUCCESS;
}

Expand All @@ -1201,9 +1197,10 @@ static apr_status_t python_filter(int is_input, ap_filter_t *f,
static apr_status_t python_input_filter(ap_filter_t *f,
apr_bucket_brigade *bb,
ap_input_mode_t mode,
apr_size_t *readbytes)
apr_read_type_e block,
apr_off_t readbytes)
{
return python_filter(1, f, bb, mode, readbytes);
return python_filter(1, f, bb, mode, block, readbytes);
}


Expand All @@ -1216,7 +1213,7 @@ static apr_status_t python_input_filter(ap_filter_t *f,
static apr_status_t python_output_filter(ap_filter_t *f,
apr_bucket_brigade *bb)
{
return python_filter(0, f, bb, 0, NULL);
return python_filter(0, f, bb, 0, 0, 0);
}


Expand Down

0 comments on commit 9853b80

Please sign in to comment.