Mod Cplusplus CVS committal
Author : gr84b8
Project : mod_cplusplus
Module : example
Dir : mod_cplusplus/example/handler
Modified Files:
test_handler.cpp test_handler.h
Log Message:
add in environ decoding, request streaming, and updated the test suite and exmaples (Submitted by: Nathan Stitt <na...@st...>)
===================================================================
RCS file: /cvsroot/modcplusplus/mod_cplusplus/example/handler/test_handler.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- test_handler.cpp 21 Apr 2002 19:13:27 -0000 1.9
+++ test_handler.cpp 26 Apr 2002 18:57:00 -0000 1.10
@@ -1,4 +1,5 @@
#include "test_handler.h"
+#include "request_env.h"
TestHandler::TestHandler()
: ApacheHandler()
@@ -15,23 +16,44 @@
char buf[1024 * 8];
apr_size_t len_read;
apr_status_t rc;
-
- ap_setup_client_block(pRequest->get_request_rec(), REQUEST_CHUNKED_DECHUNK);
+ request_env ap( pRequest->get_request_rec() );
mHits++;
- pRequest->rprintf("\nThis handler has dealt with %d hits", mHits);
- pRequest->rputs("\nLets Dump The Request!\n");
+ ap << "This handler has dealt with " << mHits << " hits \n";
+ ap << "Testing for param name BOO" << std::endl;
+
pRequest->dump();
+
ap_setup_client_block(pRequest->get_request_rec(), REQUEST_CHUNKED_ERROR);
if( (pRequest->method_number() == M_POST) ||
(pRequest->method_number() == M_PUT) ) {
- pRequest->rprintf("Content:");
+ ap << "Content:";
while((len_read = pRequest->get_client_block(buf,
sizeof(buf))) > 0) {
- pRequest->rprintf("%s", apr_pstrndup(pRequest->pool(),
- buf, len_read));
+ ap << apr_pstrndup(pRequest->pool(), buf, len_read);
+ ap << std::endl;
+ }
+ }
+
+ env_value *boo = ap["BOO"];
+
+ if ( boo ){
+ ap << "Found! Has " << boo->num_vals() << " Values.\n";
+
+ for ( env_value::const_iterator it = boo->begin();
+ it != boo->end(); it++ ){
+
+ ap << " " << (*it) << std::endl;
}
+ } else {
+ ap << "Not Found!\n";
}
+
+ ap.width(40);
+ ap.fill('-');
+ ap << "\n" << "I will now dump out everything I recieved\n";
+ ap.dump();
+
return OK;
}
===================================================================
RCS file: /cvsroot/modcplusplus/mod_cplusplus/example/handler/test_handler.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- test_handler.h 24 May 2001 18:53:15 -0000 1.3
+++ test_handler.h 26 Apr 2002 18:57:00 -0000 1.4
@@ -3,7 +3,7 @@
class TestHandler : public ApacheHandler
{
private:
- int mHits;
+ unsigned int mHits;
public:
TestHandler(void);
~TestHandler(void);
|