Thread: [Modcplusplus-user] It works.
Brought to you by:
gr84b8,
johnksterling
From: <gra...@ax...> - 2005-03-31 08:48:42
|
Hi John, The installation of the latest version (1.5.1) was succesful. But still I have some questions. My cpp file looks like this: #include "apache_handler.h" class TestHandler : public ApacheHandler { public: TestHandler(void); ~TestHandler(void); int handler(ApacheRequestRec *pRequest); }; TestHandler::TestHandler(void) { ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "constructing a mod_cplusplus handler."); } TestHandler::~TestHandler(void) { ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "destroying a mod_cplusplus handler."); } int TestHandler::handler(ApacheRequestRec *pRequest) { ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "handling, handling, handling."); pRequest->rprintf("\nThis handler is called for user %s", pRequest->user()); pRequest->rputs("\nLets Dump The Request!\n"); pRequest->dump(); return OK; } ApacheHandler *instanciate_test() { return new TestHandler(); } cpp_factory_t test_handler = { instanciate_test, NULL, NULL, NULL, }; My httpd.conf contains these lines: LoadModule cplusplus_module /usr/local/apache2/modules/libmod_cplusplus.so and I defined the followings: LoadCPPHandler test_handler /usr/local/apache2/modules/test_handler.so Alias /cppt/ "/home/grafl/c_cpp/mod_apache2/mod_cpp_test/" <Directory "/home/grafl/c_cpp/mod_apache2/mod_cpp_test"> AllowOverride None Options Indexes FollowSymLinks Order allow,deny Allow from all AddHandler test_handler .axf </Directory> In this folder I have an index.axf file which contains only HTML mark-up. When I point my browser to http://host/cppt/index.axf it asks me to download or save the file. Second, none of the operations "ap_log_error" works. -- Graf László \\|// (O-O) --oOO--(_)--OOo--- --------------------------- 100% újrahasznosított bitek |
From: John S. <jo...@st...> - 2005-03-31 12:14:34
|
Hi Graf - Glad to hear the install problems are resolved. The problem below is=20 probably configuration related - in your directory block you have=20 'AddHandler test_handler' - it should be AddCppHandler test_handler. =20 The AddCppHandler, however, doesn't support only calling if for certain=20= extensions. To solve that you can use PassCPPVar to tell your module=20 the extensions that it should handle, and have it return DECLINED for=20 all others. Let me know if you have any more questions or problems - or if you have=20= suggestions. I'm happy to extend the features if you have some good=20 ideas. John On Mar 31, 2005, at 3:46 AM, Graf L=E1szl=F3 wrote: > Hi John, > > The installation of the latest version (1.5.1) was succesful. > But still I have some questions. > > My cpp file looks like this: > > #include "apache_handler.h" > > class TestHandler : public ApacheHandler > { > public: > TestHandler(void); > ~TestHandler(void); > int handler(ApacheRequestRec *pRequest); > }; > > TestHandler::TestHandler(void) { > ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "constructing a=20 > mod_cplusplus handler."); > } > > TestHandler::~TestHandler(void) { > ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "destroying a=20 > mod_cplusplus handler."); > } > > int TestHandler::handler(ApacheRequestRec *pRequest) > { > ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "handling, handling,=20= > handling."); > pRequest->rprintf("\nThis handler is called for user %s",=20 > pRequest->user()); > pRequest->rputs("\nLets Dump The Request!\n"); > pRequest->dump(); > return OK; > } > > ApacheHandler *instanciate_test() > { > return new TestHandler(); > } > > cpp_factory_t test_handler =3D { > instanciate_test, > NULL, > NULL, > NULL, > }; > > My httpd.conf contains these lines: > > LoadModule cplusplus_module=20 > /usr/local/apache2/modules/libmod_cplusplus.so > > and I defined the followings: > > LoadCPPHandler test_handler =20 > /usr/local/apache2/modules/test_handler.so > > Alias /cppt/ "/home/grafl/c_cpp/mod_apache2/mod_cpp_test/" > <Directory "/home/grafl/c_cpp/mod_apache2/mod_cpp_test"> > AllowOverride None > Options Indexes FollowSymLinks > Order allow,deny > Allow from all > AddHandler test_handler .axf > </Directory> > > In this folder I have an index.axf file which contains only HTML=20 > mark-up. > > When I point my browser to http://host/cppt/index.axf it asks me to=20 > download or save the file. > Second, none of the operations "ap_log_error" works. > > --=20 > Graf L=E1szl=F3 > > \\|// > (O-O) > --oOO--(_)--OOo--- > --------------------------- > 100% =FAjrahasznos=EDtott bitek > |
From: <gra...@ax...> - 2005-03-31 12:36:18
|
Thank you. With the change suggested by you it works, finally. An only for HTM and HTML extensions. Alias /cppt/ "/home/grafl/c_cpp/mod_apache2/mod_cpp_test/" <Directory "/home/grafl/c_cpp/mod_apache2/mod_cpp_test"> AllowOverride None Options Indexes FollowSymLinks Order allow,deny Allow from all AddCppHandler test_handler PassCPPVar test_handler axf </Directory> But the PassCPPVar has no effect on its behaviour. I would like that the handler to be called only for axf extensions. By the way, do you know the project PAS [http://pas.sourceforge.net/] ? I intend to implement something like that using mod_cplusplus. László John Sterling wrote: > Hi Graf - > > Glad to hear the install problems are resolved. The problem below is > probably configuration related - in your directory block you have > 'AddHandler test_handler' - it should be AddCppHandler test_handler. > The AddCppHandler, however, doesn't support only calling if for certain > extensions. To solve that you can use PassCPPVar to tell your module > the extensions that it should handle, and have it return DECLINED for > all others. > > Let me know if you have any more questions or problems - or if you have > suggestions. I'm happy to extend the features if you have some good ideas. > > John > > On Mar 31, 2005, at 3:46 AM, Graf László wrote: > >> Hi John, >> >> The installation of the latest version (1.5.1) was succesful. >> But still I have some questions. >> >> My cpp file looks like this: >> >> #include "apache_handler.h" >> >> class TestHandler : public ApacheHandler >> { >> public: >> TestHandler(void); >> ~TestHandler(void); >> int handler(ApacheRequestRec *pRequest); >> }; >> >> TestHandler::TestHandler(void) { >> ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "constructing a >> mod_cplusplus handler."); >> } >> >> TestHandler::~TestHandler(void) { >> ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "destroying a >> mod_cplusplus handler."); >> } >> >> int TestHandler::handler(ApacheRequestRec *pRequest) >> { >> ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "handling, handling, >> handling."); >> pRequest->rprintf("\nThis handler is called for user %s", >> pRequest->user()); >> pRequest->rputs("\nLets Dump The Request!\n"); >> pRequest->dump(); >> return OK; >> } >> >> ApacheHandler *instanciate_test() >> { >> return new TestHandler(); >> } >> >> cpp_factory_t test_handler = { >> instanciate_test, >> NULL, >> NULL, >> NULL, >> }; >> >> My httpd.conf contains these lines: >> >> LoadModule cplusplus_module >> /usr/local/apache2/modules/libmod_cplusplus.so >> >> and I defined the followings: >> >> LoadCPPHandler test_handler /usr/local/apache2/modules/test_handler.so >> >> Alias /cppt/ "/home/grafl/c_cpp/mod_apache2/mod_cpp_test/" >> <Directory "/home/grafl/c_cpp/mod_apache2/mod_cpp_test"> >> AllowOverride None >> Options Indexes FollowSymLinks >> Order allow,deny >> Allow from all >> AddHandler test_handler .axf >> </Directory> >> >> In this folder I have an index.axf file which contains only HTML mark-up. >> >> When I point my browser to http://host/cppt/index.axf it asks me to >> download or save the file. >> Second, none of the operations "ap_log_error" works. >> >> -- >> Graf László >> >> \\|// >> (O-O) >> --oOO--(_)--OOo--- >> --------------------------- >> 100% újrahasznosított bitek >> > -- Graf László \\|// (O-O) --oOO--(_)--OOo--- --------------------------- 100% újrahasznosított bitek |
From: John K. S. <jo...@st...> - 2005-03-31 14:02:57
|
Hi - Right - mod_cplusplus currently doesn't filter handlers by file extension. What I was suggesting is that your test module do that by having the handler() method check the uri and return DECLINED if the extension is wrong. I think that would be a good addition to the core mod_cplusplus, though - so I'll look into it. As for the idea to make an app server for c++, I have wanted to extend mod_cplusplus to do that for quite some time now! I'll think about it if you want some suggestions on how to tackle it. I'll let you know if I decide to modify the AddCPPHandler to take in an option extention (like addhandler does). John > Thank you. With the change suggested by you it works, finally. > An only for HTM and HTML extensions. > > Alias /cppt/ "/home/grafl/c_cpp/mod_apache2/mod_cpp_test/" > <Directory "/home/grafl/c_cpp/mod_apache2/mod_cpp_test"> > AllowOverride None > Options Indexes FollowSymLinks > Order allow,deny > Allow from all > AddCppHandler test_handler > PassCPPVar test_handler axf > </Directory> > > But the PassCPPVar has no effect on its behaviour. > > I would like that the handler to be called only for axf extensions. By > the way, do you know the project PAS [http://pas.sourceforge.net/] ? I > intend to implement something like that using mod_cplusplus. > > L=E1szl=F3 > > John Sterling wrote: >> Hi Graf - >> >> Glad to hear the install problems are resolved. The problem below is >> probably configuration related - in your directory block you have >> 'AddHandler test_handler' - it should be AddCppHandler test_handler. >> The AddCppHandler, however, doesn't support only calling if for >> certain extensions. To solve that you can use PassCPPVar to tell >> your module the extensions that it should handle, and have it return >> DECLINED for all others. >> >> Let me know if you have any more questions or problems - or if you >> have suggestions. I'm happy to extend the features if you have some >> good ideas. >> >> John >> >> On Mar 31, 2005, at 3:46 AM, Graf L=E1szl=F3 wrote: >> >>> Hi John, >>> >>> The installation of the latest version (1.5.1) was succesful. >>> But still I have some questions. >>> >>> My cpp file looks like this: >>> >>> #include "apache_handler.h" >>> >>> class TestHandler : public ApacheHandler >>> { >>> public: >>> TestHandler(void); >>> ~TestHandler(void); >>> int handler(ApacheRequestRec *pRequest); >>> }; >>> >>> TestHandler::TestHandler(void) { >>> ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "constructing a >>> mod_cplusplus handler."); >>> } >>> >>> TestHandler::~TestHandler(void) { >>> ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "destroying a >>> mod_cplusplus handler."); >>> } >>> >>> int TestHandler::handler(ApacheRequestRec *pRequest) >>> { >>> ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "handling, >>> handling, >>> handling."); >>> pRequest->rprintf("\nThis handler is called for user %s", >>> pRequest->user()); >>> pRequest->rputs("\nLets Dump The Request!\n"); >>> pRequest->dump(); >>> return OK; >>> } >>> >>> ApacheHandler *instanciate_test() >>> { >>> return new TestHandler(); >>> } >>> >>> cpp_factory_t test_handler =3D { >>> instanciate_test, >>> NULL, >>> NULL, >>> NULL, >>> }; >>> >>> My httpd.conf contains these lines: >>> >>> LoadModule cplusplus_module >>> /usr/local/apache2/modules/libmod_cplusplus.so >>> >>> and I defined the followings: >>> >>> LoadCPPHandler test_handler >>> /usr/local/apache2/modules/test_handler.so >>> >>> Alias /cppt/ "/home/grafl/c_cpp/mod_apache2/mod_cpp_test/" >>> <Directory "/home/grafl/c_cpp/mod_apache2/mod_cpp_test"> >>> AllowOverride None >>> Options Indexes FollowSymLinks >>> Order allow,deny >>> Allow from all >>> AddHandler test_handler .axf >>> </Directory> >>> >>> In this folder I have an index.axf file which contains only HTML >>> mark-up. >>> >>> When I point my browser to http://host/cppt/index.axf it asks me to >>> download or save the file. >>> Second, none of the operations "ap_log_error" works. >>> >>> -- >>> Graf L=E1szl=F3 >>> >>> \\|// >>> (O-O) >>> --oOO--(_)--OOo--- >>> --------------------------- >>> 100% =FAjrahasznos=EDtott bitek >>> >> > > -- > Graf L=E1szl=F3 > > \\|// > (O-O) > --oOO--(_)--OOo--- > --------------------------- > 100% =FAjrahasznos=EDtott bitek > > > ------------------------------------------------------- > This SF.net email is sponsored by Demarc: > A global provider of Threat Management Solutions. > Download our HomeAdmin security software for free today! > http://www.demarc.com/info/Sentarus/hamr30 > _______________________________________________ > Modcplusplus-user mailing list > Mod...@li... > https://lists.sourceforge.net/lists/listinfo/modcplusplus-user |