Re: [users@httpd] Writting own module

2018-04-11 Thread Eric Covener
On Wed, Apr 11, 2018 at 5:47 AM, Hemant Chaudhary
 wrote:
> Hi All,
>
> I am writing my own module just to check process flow. I am bale to start
> the server successfully after add this module but while sending request from
> browser, I am getting error that requested URL is not found on server.
> Whereas without the module everything works fine.

Your logging call looks suspicious. You should use _rerror since your
context has request_rec passed to it.
I have no idea if passing a NULL to _perror is safe.

Generally: Try a command-line client and the error log to get more specifics.
A handler that returns DECLINED and does nothing else should not cause
an HTTP error but browser output is not helpful for PD.

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



[users@httpd] Writting own module

2018-04-11 Thread Hemant Chaudhary
Hi All,

I am writing my own module just to check process flow. I am bale to start
the server successfully after add this module but while sending request
from browser, I am getting error that requested URL is not found on server.
Whereas without the module everything works fine.

My Module is like:
#include "apr.h"
#include "apr_strings.h"
#include "apr_lib.h"
#include "apr_fnmatch.h"
#include "apr_hash.h"
#include "apr_thread_proc.h"/* for RLIMIT stuff */
#include "apr_random.h"

#define APR_WANT_IOVEC
#define APR_WANT_STRFUNC
#define APR_WANT_MEMFUNC
#include "apr_want.h"
#include
"/home/hemant/apache-2.4.25/httpd-2.4.25/srclib/apr/include/apr_general.h"
#include "ap_config.h"
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_protocol.h" /* For index_of_response().  Grump. */
#include "http_request.h"
#include "http_vhost.h"
#include "http_main.h" /* For the default_handler below... */
#include "http_log.h"
#include "util_md5.h"
#include "http_connection.h"
#include "apr_buckets.h"
#include "util_filter.h"
#include "util_ebcdic.h"
#include "util_mutex.h"
#include "util_time.h"
#include "mpm_common.h"
#include "scoreboard.h"
#include "mod_core.h"
#include "mod_proxy.h"
#include "ap_listen.h"

int hemant_handler(request_rec *r)
{
#ifdef __DEBUG
ap_log_perror(APLOG_MARK, APLOG_NOTICE, 0, NULL, APLOGNO(00067)
  "Flow Debug Hemant: In function hemant_handler for
PID=%d and PPID=%d of /server/hemant_test.c",getpid(),getppid());
#endif
return DECLINED;

}


static void register_hooks(apr_pool_t *p)
{

ap_hook_handler(hemant_handler,NULL,NULL,APR_HOOK_MIDDLE);
}

AP_DECLARE_MODULE(hemant_test) =
{
STANDARD20_MODULE_STUFF,
NULL,   /* dir config creater */
NULL,   /* dir config creater */
NULL,   /* dir merger --- default is to override */
NULL,   /* server config */
NULL,   /* merge server config */
register_hooks  /* register hooks */
};

Please let me know, what am I missing.
Thanks
Hemant