• Included
  • 7.8.1 Module Configuration
  • Module definition for configuration
  • 7.8.2 Handlers The 2.0.x handlers array is now a series of ap_hook_handler calls in the register_hooks function. List of content handlers available from this module
  • 7.8.3 Directives List
  • 7.8.4 Initialization and Exiting
  • Child process exit handling
  • September 2008 Migration Guide




    Download 1.14 Mb.
    bet6/11
    Sana21.03.2017
    Hajmi1.14 Mb.
    1   2   3   4   5   6   7   8   9   10   11

    7.6.2.6 New “Edit Config Files” screen in HP-UX Webmin-based Admin:



    This new screen allows you to directly edit and save configuration files, including the httpd.conf file. Any Included files can be selected through the dropdown menu. This is a new feature as of Webmin 1.020.

    7.7 Migrating the Printing of Virtual Host Configuration

    The httpd command line option –S, which was used for printing the virtual host configuration has been replaced by -t -D DUMP _VHOSTS.



    7.8 Writing 2.x Modules
    The major semantic change is that operations that were defined in the module configuration structure and the handler array are now defined in the register_hooks function.

    The following code is based on mod_example . c versions 2.0.x and 2.x. The 2.x version can be found at: /opt/hpws22/apache/build/example/opt/hpws/apache/build/example s/mod_example. c.

    For instructions on building mod _example, /opt/hpws22/apache/build/examples/READMEsee /opt/hpws/apache/build/examples/README.

    7.8.1 Module Configuration

    The module definition for configuration has changed dramatically. The register_hooks function is now used to setup options that were previously defined in the configuration module.

    In the Module definition for configuration, if a particular callback is not needed, replace its routine name below with NULL. For Apache 2.0.x, the number in brackets indicates the order in which the routine is called during request processing. A specific module will only use those hooks that it finds necessary.

    Module definition for configuration

    Apache 2.0.x

    Apache 2.x

    module MODULE _VAR _EXPORT example_module =

    {

    STANDARD_MODULE_STUFF,



    module AP_MODULE_DECLARE_DATA example_module =

    {

    STANDARD20_MODULE_STUFF,



    x_create_dir_config,

    /* per-directory config creator */

    x_merge_dir_config,

    /* dir config merger */

    x_create_server_config,

    /* server config creator */



    example _init,

    /* initializer */


    module

    A




    example_create_dir_config,

    /* per-directory config creator */

    example_merge_dir_config, /* dir config merger */

    example _create _server _config, /* server config creator */

    example _merge _server _config, /* server config merger */

    example _cmds,

    /* command table */











    x_merge_server_config, /*server config merger */

    x_cmds,


    /* command table */

    x _register _hooks,

    /* set up other request processing hooks

    */ };


    example _handlers,

    /* [ 9] list of handlers */



    B













    example late ,

    _trans _handle



    C




    /* [ 2] filename-to-URI translation
    */










    D




    example_check_user_id,

    /* [ 5] check/validate user_id

    example_auth_checker,

    /* [ 6] check user_id is valid



    */

    *here*





    */

    E













    example_access_checker,

    F




    /* [ 4] check access by host address




    */

    example_type_checker,

    G




    /* [ 7] MIME type checker/setter




    */

    example_fixer_upper, /* [ 8] fixups */

    H










    example_logger,

    /* [ 10] logger */



    I



















    There is no corresponding hook in 2.2.x. You must parse the bucket brigade instead. For information on bucket brigades, see www.onlamp.com/pub/a/apache/2001/09/20/a




    example_header_parser, /* [ 3] header parser * /

    J













    example_child_init,

    /* process initializer */



    K







    pache 2.html.
















    example_child_exit,

    /* process exit/cleanup */



    L




    example_post_read_request

    /* [ 1] post read_request handling






    */ };

    M










    static void x _register _hooks (apr _pool _t *p) {

    ap_hook_pre_con fig (x_pre_con fig,



    NULL,

    A NULL,

    APR_HOOK_MIDDLE);

    ap hook post_config (x_post_config,

    NULL, NULL,



    A

    APR_HOOK_MIDDLE);



    For module initialization hook to pre_ or post_ config, as necessary.







    ap _hook _open _logs (x _open _logs,

    NULL, NULL, APR_HOOK_MIDDLE);

    ap_hook child_init (x_child_init,





    K

    NULL, NULL,

    APR_HOOK_MIDDLE);

    ap _hook _handler (x_handler,






    B

    NULL, NULL,

    APR_HOOK_MIDDLE);

    ap _hook _quick _handler (x _quick _handler,

    NULL, NULL, APR_HOOK_MIDDLE);

    ap_hook_pre_connection (x_pre_connection,

    NULL,

    NULL, APR_HOOK_MIDDLE);



    /* This module doesn't have a process

    c

    onnection phase, but I am leaving

    the code in, in-case somebody wants to add one. */

    /* ap_hook_process_connection

    (x_fixer_upper,

    NULL, NULL, APR_HOOK_MIDDLE); */

    ap _hook_post _read _request (x_post _read _request,


    M
    NULL, NULL,

    APR _HOOK _MIDDLE);

    ap_hook_log_transaction (x_logger,


    I

    NULL, NULL, APR_HOOK_MIDDLE);




    ap_hook_http_method (x_http_method,

    NULL, NULL, APR_HOOK_MIDDLE);

    ap _hook _default _port (x _default _port,

    NULL, NULL, APR_HOOK_MIDDLE);

    ap _hook _translate _name (x _translate _handler,

    NULL,


    C NULL,

    APR _HOOK _MIDDLE);

    ap_hook_check_user_id (x_check_user_id,

    D NULL,

    NULL, APR_HOOK_MIDDLE);

    ap_hook_fixups (x_fixer_upper,

    NULL,


    H APR_HOOK_MIDDLE); NULL,

    ap_hook_type_checker (x_type_checker,

    NULL,

    G NULL,

    APR_HOOK_MIDDLE);

    ap_hook_access_checker (x_access_checker,

    NULL,


    F NULL,

    APR_HOOK_MIDDLE);

    ap_hook_auth_checker (x_auth_checker,

    NULL,


    E NULL,



    APR_HOOK_MIDDLE);

    ap _hook _insert _filter (x _insert _filter,

    NULL, NULL, APR_HOOK_MIDDLE);

    }



    7.8.2 Handlers
    The 2.0.x handlers array is now a series of ap_hook_handler calls in the register_hooks function.

    List of content handlers available from this module


    Apache 2.0.x

    Apache 2.2.x

    static const handler _rec

    example _handlers[ ]

    static const handler x_handlers[ ] =

    _rec


    =




    {

    {

    {"example-handler", {NULL}



    example _handler},

    {"example-handler", x _handler},
    {NULL}

    };


    };













    static void register_hooks (apr _pool _t *p)







    {







    ...







    ap _hook




    (x_handler,

    NULL, NULL, APR_HOOK_MIDDLE);

    _handler


    D










    ...







    }

    7.8.3 Directives List

    Notice that in the example NO_ARGS becomes the AP_INIT_NO_ARGS macro.



    List of directives specific to our module





    Apache 2.0.x







    Apache 2.2.x

    static const command_rec example_cmds[ ]

    =

    static const command_rec x_cmds[ ] =

    {







    {




    {







    AP_INIT_NO_ARGS(

    "Example", cmd _example,

    /* directive name */

    /* config action routine



    */

    "Example", cmd_example,

    /* directive name */

    /* config action routine */



    NULL, /* argument to include in call

    OR_OPTIONS, /* where available */



    */

    NULL, OR_OPTIONS,

    /* arg to include in call */
    /* where available */

    NO_ARGS,

    /* arguments */




    "Example directive - no arguments"

    "Example directive - no arguments"







    /* directive description */

    }, {NULL}

    /* directive description */

    ),

    {NULL} };






    };













    7.8.4 Initialization and Exiting

    Set a cleanup register, as shown in the table below.



    Apache 2.0.x

    Apache 2.2.x

    static void

    static void

    example _child _init (server_rec *s,

    pool *p)


    x_child_init (apr_pool _t *p,

    server_rec *s)



    {

    {

    char *note;

    char *note;

    char *sname = s->server_hostname;

    char *sname = s->server_hostname;

    /* Set up any module cells that ought

    /* Set up any module cells that ought

    to be initialised. */

    to be initialised. */

    setup_module_cells ();

    Setup_module_cells ();

    /* The arbitrary text we add to our

    /* The arbitrary text we add to our trace

    trace entry indicates for which

    entry indicates for which server we're

    server we're being called. */

    being called. */

    sname = (sname != NULL) ? sname : "";

    Sname = (sname != NULL) ? sname : "";

    note = ap_pstrcat(p,

    note = apr_pstrcat(p,

    "example _child _init (", sname,

    ")",


    NULL);

    trace_add(s, NULL, NULL, note);



    "x_child_init (", sname,

    ")", NULL);

    Trace_add(s, NULL, NULL, note);




















    }

    apr_pool _cleanup _register (p,

    s,


    L










    x_child_exit,







    x_child_exit);




    }

    Child process exit handling


    Apache 2.0.x




    Apache 2.2.x

    static void




    static apr_status_t

    example_child_exit (server_rec * s,

    pool *p)





    x_child_exit (void *data)

    {




    {

    char *note;



    char *note;




    server_rec *s = data;

    char *sname = s->server_hostname;




    char *sname = s->server_hostname;

    /* The arbitrary text we add to our

    /* The arbitrary text we add to our

    trace entry indicates for which




    trace entry indicates for which

    server we're being called. */




    server we're being called. */

    sname = (sname != NULL) ? sname :

    "";

    sname = (sname != NULL) ? sname : "";

    note = ap_pstrcat(p,

    "example _child _exit (", sname,

    " ) " ,

    NULL);





    note = apr_pstrcat(s->process->pool, "x _child _exit (",

    sname, " ) ",

    NULL);


    trace_add(s, NULL, NULL, note);




    trace_add(s, NULL, NULL, note);

    }




    return APR_SUCCESS;







    }

    1   2   3   4   5   6   7   8   9   10   11


    Download 1.14 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa


    September 2008 Migration Guide

    Download 1.14 Mb.