This is a discussion on Without result within the Windows Web Servers forums, part of the Web Server and Related Forums category; Hi all I am a newbie in apache module writing. Using MSVC++ 6.0 and Apache 1.3.33 on ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi all
I am a newbie in apache module writing. Using MSVC++ 6.0 and Apache 1.3.33 on Windows 2000 Prof I created the file mod_hello.c (see below) and I did attache it to a dll project. The build was succesfuly. I made the necesary changes in httpd.conf: LoadFile "C:/Program Files/Microsoft Visual Studio/MyProjects/apache/mod_hello/Debug/mod_hello.dll" LoadModule hello_module "C:/Program Files/Microsoft Visual Studio/MyProjects/apache/mod_hello/Debug/mod_hello.dll" and Alias /gl/ "C:/Program Files/Apache Group/Apache/htdocs/gl/" <Directory "C:/Program Files/Apache Group/Apache/htdocs/gl"> SetHandler hello_module </Directory> After restarting the Apache server, I did access the site http://abc/gl/index.html but without result. I access.log appears this line: xxx.xxx.xxx.xxx [03/Jan/2005:13:10:47 +0100] "GET /gl/index.html HTTP/1.1" 304 - What is wrong? Thank you in advance for your reply. --------------------------------------------------------------- Laszlo Graf ----------- mod_hello.c #include "httpd.h" #include "http_config.h" #include "http_core.h" #include "http_log.h" #include "http_protocol.h" /* file: mod_hello.c */ /* here's the content handler */ static int hello_handler(request_rec *r) { const char* hostname; r->content_type = "text/html"; ap_send_http_header(r); hostname = ap_get_remote_host(r->connection,r->per_dir_config,REMOTE_NAME); ap_rputs("<HTML>\n" ,r); ap_rputs("<HEAD>\n" ,r); ap_rputs("<TITLE>Hello There</TITLE>\n" ,r); ap_rputs("</HEAD>\n" ,r); ap_rputs("<BODY>\n" ,r); ap_rprintf(r,"<H1>Hello %s</H1>\n" ,hostname); ap_rputs("Who would take this book seriously if the first example didn't\n",r); ap_rputs("say \"hello world\"?\n" ,r); ap_rputs("</BODY>\n" ,r); ap_rputs("</HTML>\n" ,r); return OK; } /* Make the name of the content handler known to Apache */ static handler_rec hello_handlers[] = { {"hello-handler", hello_handler}, {NULL} }; /* Tell Apache what phases of the transaction we handle */ module MODULE_VAR_EXPORT hello_module = { STANDARD_MODULE_STUFF, NULL, /* module initializer */ NULL, /* per-directory config creator */ NULL, /* dir config merger */ NULL, /* server config creator */ NULL, /* server config merger */ NULL, /* command table */ hello_handlers, /* [9] content handlers */ NULL, /* [2] URI-to-filename translation */ NULL, /* [5] check/validate user_id */ NULL, /* [6] check user_id is valid *here* */ NULL, /* [4] check access by host address */ NULL, /* [7] MIME type checker/setter */ NULL, /* [8] fixups */ NULL, /* [10] logger */ NULL, /* [3] header parser */ NULL, /* process initialization */ NULL, /* process exit/cleanup */ NULL /* [1] post read_request handling */ }; |