cvs: php4 /sapi/apache2filter README sapi_apache2.c

From: Date: Wed, 01 Nov 2000 19:19:47 +0000
Subject: cvs: php4 /sapi/apache2filter README sapi_apache2.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-2402@lists.php.net to get a copy of this message
sas Wed Nov 1 11:19:47 2000 EDT Modified files: /php4/sapi/apache2filter README sapi_apache2.c Log: Use Input filters for handling POST data Index: php4/sapi/apache2filter/README diff -u php4/sapi/apache2filter/README:1.3 php4/sapi/apache2filter/README:1.4 --- php4/sapi/apache2filter/README:1.3 Sun Oct 29 09:48:13 2000 +++ php4/sapi/apache2filter/README Wed Nov 1 11:19:46 2000 @@ -40,7 +40,7 @@ <Files *.php> AddOutputFilter PHP - AddRequestBodyFilter PHP + AddInputFilter PHP </Files> That's it. Now start bin/httpd. Index: php4/sapi/apache2filter/sapi_apache2.c diff -u php4/sapi/apache2filter/sapi_apache2.c:1.15 php4/sapi/apache2filter/sapi_apache2.c:1.16 --- php4/sapi/apache2filter/sapi_apache2.c:1.15 Sun Oct 29 09:43:23 2000 +++ php4/sapi/apache2filter/sapi_apache2.c Wed Nov 1 11:19:46 2000 @@ -232,19 +232,25 @@ ctx->bb = ap_brigade_create(f->c->pool); \ } -static int php_rbody_filter(ap_filter_t *f, ap_bucket_brigade *bb) +static int php_input_filter(ap_filter_t *f, ap_bucket_brigade *bb, + ap_input_mode_t mode) { php_struct *ctx; long old_index; ap_bucket *b; const char *str; apr_ssize_t n; + apr_status_t rv; SLS_FETCH(); ctx = SG(server_context); INIT_CTX; + if ((rv = ap_get_brigade(f->next, bb, mode)) != APR_SUCCESS) { + return rv; + } + AP_BRIGADE_FOREACH(b, bb) { ap_bucket_read(b, &str, &n, 1); if (n > 0) { @@ -254,10 +260,10 @@ memcpy(ctx->post_data + old_index, str, n); } } - return ap_pass_brigade(f->next, bb); + return APR_SUCCESS; } -static int php_filter(ap_filter_t *f, ap_bucket_brigade *bb) +static int php_output_filter(ap_filter_t *f, ap_bucket_brigade *bb) { php_struct *ctx; ap_bucket *b; @@ -292,7 +298,7 @@ /* XXX: Lots of startup crap. Should be moved into its own func */ PG(during_request_startup) = 0; SG(sapi_headers).http_response_code = 200; - SG(request_info).content_type = apr_table_get(f->r->headers_in, "Content-Type"); + SG(request_info).content_type = (char *) apr_table_get(f->r->headers_in, "Content-Type"); SG(request_info).query_string = f->r->args; SG(request_info).request_method = (char *) f->r->method; SG(request_info).request_uri = f->r->uri; @@ -414,8 +420,8 @@ static void php_register_hook(void) { ap_hook_child_init(php_apache_server_startup, NULL, NULL, AP_HOOK_MIDDLE); - ap_register_output_filter("PHP", php_filter, AP_FTYPE_CONTENT); - ap_register_rbody_filter("PHP", php_rbody_filter, AP_FTYPE_CONTENT); + ap_register_output_filter("PHP", php_output_filter, AP_FTYPE_CONTENT); + ap_register_input_filter("PHP", php_input_filter, AP_FTYPE_CONTENT); } module MODULE_VAR_EXPORT php4_module = {

« previous php.cvs (#2402) next »