cvs: php4 /sapi/apache2filter php_apache.h sapi_apache2.c

From: Date: Fri, 27 Oct 2000 23:02:20 +0000
Subject: cvs: php4 /sapi/apache2filter php_apache.h sapi_apache2.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-2321@lists.php.net to get a copy of this message
sas Fri Oct 27 16:02:20 2000 EDT Modified files: /php4/sapi/apache2filter php_apache.h sapi_apache2.c Log: POST handler for my ubercool new Apache 2.0 function ap_get_req_body. Index: php4/sapi/apache2filter/php_apache.h diff -u php4/sapi/apache2filter/php_apache.h:1.1 php4/sapi/apache2filter/php_apache.h:1.2 --- php4/sapi/apache2filter/php_apache.h:1.1 Thu Oct 26 10:55:05 2000 +++ php4/sapi/apache2filter/php_apache.h Fri Oct 27 16:02:20 2000 @@ -5,6 +5,7 @@ int state; ap_bucket_brigade *bb; ap_filter_t *f; + int post_index; } php_struct; void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf); Index: php4/sapi/apache2filter/sapi_apache2.c diff -u php4/sapi/apache2filter/sapi_apache2.c:1.10 php4/sapi/apache2filter/sapi_apache2.c:1.11 --- php4/sapi/apache2filter/sapi_apache2.c:1.10 Fri Oct 27 08:40:16 2000 +++ php4/sapi/apache2filter/sapi_apache2.c Fri Oct 27 16:02:20 2000 @@ -88,8 +88,22 @@ static int php_apache_sapi_read_post(char *buf, uint count_bytes SLS_DC) { + long total; + long n; + long start; + php_struct *ctx = SG(server_context); + + start = ctx->post_index; + for (total = 0; total < count_bytes; total += n) { + n = ap_get_req_body(ctx->f->r, count_bytes - total, &ctx->post_index); + if (n <= 0) break; + } + + if (total > 0) { + memcpy(buf, &ctx->f->r->req_body[start], total); + } - return 0; + return total; } static char * @@ -220,15 +234,15 @@ SLS_FETCH(); apply_config(conf); - php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC); ctx->state++; /* 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).query_string = f->r->args; - SG(request_info).request_method = f->r->method; + SG(request_info).request_method = (char *) f->r->method; SG(request_info).request_uri = f->r->uri; f->r->no_cache = f->r->no_local_copy = 1; content_type = sapi_get_default_content_type(SLS_C); @@ -239,6 +253,8 @@ apr_table_unset(f->r->headers_out, "Expires"); auth = apr_table_get(f->r->headers_in, "Authorization"); php_handle_auth_data(auth SLS_CC); + + php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC); } /* moves all buckets from bb to ctx->bb */

« previous php.cvs (#2321) next »