|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
The problem that I am having is that I cannot get link on my test web
page to access my module. Even though I have been writing code for may years and C stuff since 1984, the web jargon is still new to so if I make some mistakes please be tolerant. I do not know for sure if the problem in the C module file, the httpd configuration file, or the web page. I have included snippets from each (hopefully the relevant ones). I am using release 1.3.19. 1. The C module file: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// static const handler_rec mod_ALF_HandlerList[] = { {"ALF-Test", mod_ALF_Test_Handler}, {NULL} }; module MODULE_VAR_EXPORT mod_ALF_module = { STANDARD_MODULE_STUFF, mod_ALF_init, /* module initializer */ NULL, //mod_ALF_create_dir_config, /* per-directory config creator */ NULL, //mod_ALF_merge_dir_config, /* dir config merger */ NULL, //mod_ALF_create_server_config, /* server config creator */ NULL, //mod_ALF_merge_server_config, /* server config merger */ NULL, //mod_ALF_cmds, /* command table */ mod_ALF_HandlerList, /* [9] list of handlers */ NULL, //mod_ALF_translate_handler, /* [2] filename-to-URI translation */ NULL, //mod_ALF_check_user_id, /* [5] check/validate user_id */ NULL, //mod_ALF_auth_checker, /* [6] check user_id is valid *here* */ NULL, //mod_ALF_access_checker, /* [4] check access by host address */ NULL, //mod_ALF_type_checker, /* [7] MIME type checker/setter */ NULL, //mod_ALF_fixer_upper, /* [8] fixups */ NULL, //mod_ALF_logger, /* [10] logger */ NULL, //mod_ALF_header_parser, /* [3] header parser */ mod_ALF_child_init, /* process initializer */ mod_ALF_child_exit, /* process exit/cleanup */ NULL, //mod_ALF_post_read_request /* [1] post read_request handling */ }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// I know that the modules, it is loaded as a shared object using the Apache make procedure, because I get the appropriate diagnostic messages on "module initializer" and the "child_init" & "child_exit" routines. (A side question, when apache is started as two different root process, normally pid#746 & pid#747. My understanding of the O'Reilly book on Apache is that a parent process is started which maintains the integrity of the environment a forks off children to perform the actual work. However why do I get two parent process call with two distinct pids. I thought the "module initializer" would only be called once. Now back to the primary issue.) 2. The configuration file, by order in the file, but not contiguous: ########################### ServerRoot "/usr/WES" ########################### DocumentRoot "/usr/WES/htdocs" ########################### LoadModule mod_ALF_module libexec/mod_ALF.so ########################### AddModule mod_ALF.c ########################### <IfModule mod_ALF.c> <Location /ALF/Test> SetHandler ALF-Test Order allow,deny Allow from all </Location> ErrorLog /usr/WES/logs/error_log_ALF </IfModule> ########################### A note: The "IfModule" command along with the "ErrorLog" command are there only to verify that the "Location" was being seen at start-up. Also I have tried a full path name in the "Location" command because the error log shows a 404 error and the full pathname. 3. The web page references, there are two, one with a full address and one with a relative address. Both return with a 404 error and the entries in the error log are the same: ########################### <p>Putting the link to <A HREF="http://web-enabled-solutions.com/ALF/Test">ALF 4</A> here. ########################### <p>Putting the link to <A HREF="/ALF/Test">ALF 5</A> here.</p> ########################### I have also tried full pathname based on: "DocumentRoot" in the configuration file in both the configuration file's "Location" command and the web page's "HREF". |
|
#2
|
|||
|
|||
|
Due to my limited C knowledge, I can't help you with the code. However,
<IfModule mod_ALF.c> ... .. </IfModule> The IfModule directive is the worst directive in Apache. It assumes everything to always return true. If it returns false, it's ignored without throwing any error. That said, if you really wanna see if your module is working, remove the <Ifmodule> block completely. If it fails, it surely will throw you some error to your default error log + apachectl configtest when you trying to start Apache. >> Also I have tried a full path name in the "Location" command Location always use relative path to your docroot, using full path of it is a violation to Apache and therefore it must fail. Your docroot -> /usr/WES/htdocs /ALF (relative path) -> /usr/WES/htdocs/AFS (full path) |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Getting a web page HREF to reference my C module via a Location command |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|