[Modcplusplus-devel] (gr84b8) mod_cplusplus/example/handler test_handler.cpp
Brought to you by:
gr84b8,
johnksterling
|
From: Mod C. C. L. <mod...@so...> - 2002-04-15 22:02:51
|
Mod Cplusplus CVS committal
Author : gr84b8
Project : mod_cplusplus
Module : example
Dir : mod_cplusplus/example/handler
Modified Files:
test_handler.cpp
Log Message:
add an example that handles posts to the handler examples
===================================================================
RCS file: /cvsroot/modcplusplus/mod_cplusplus/example/handler/test_handler.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- test_handler.cpp 15 Apr 2002 18:42:25 -0000 1.5
+++ test_handler.cpp 15 Apr 2002 22:02:50 -0000 1.6
@@ -11,13 +11,25 @@
int TestHandler::handler(ApacheRequestRec *pRequest)
{
+ char buf[1024 * 8];
+ apr_size_t len_read;
+ apr_status_t rc;
+
ap_setup_client_block(pRequest->get_request_rec(), REQUEST_CHUNKED_DECHUNK);
mHits++;
pRequest->rprintf("\nThis handler has dealt with %d hits", mHits);
pRequest->rputs("\nLets Dump The Request!\n");
pRequest->dump();
- pRequest->discard_request_body();
+ ap_setup_client_block(pRequest->get_request_rec(), REQUEST_CHUNKED_ERROR);
+ if( pRequest->method_number() == M_POST ) {
+ pRequest->rprintf("Content:");
+ while((len_read = ap_get_client_block(pRequest->get_request_rec(),
+ buf, sizeof(buf))) > 0) {
+ pRequest->rprintf("%s", apr_pstrndup(pRequest->pool(),
+ buf, len_read));
+ }
+ }
return OK;
}
|