This topic provides information about how to set up third party modules for your HTTP Server.
The HTTP Server (powered by Apache) can extend its functionality in specific areas of your server using modules. For example, a module could be configured to create a new type of authentication that is not available with the shipped HTTP Server (powered by Apache). The Apache Software Foundation (ASF) provides basic information for writing your own modules.Before the module can be used by your HTTP Server (powered by Apache), it must be compiled and saved in the QSYS directory. In addition, the LoadModule directive must be entered in your server configuration file along with any specific context required information.
As of i5/OS™ V5R4, modules must be recompiled with a UTF locale. This creates an environment where locale-dependent C runtime functions assume that string data is encoded in UTF-8. Any hardcoded constants can be encoded in UTF-8 by adding a #pragma convert(1208) statement in the module. Additionally, input data from the client will no longer be converted to EBCDIC but will be passed as-is. Output data sent from the module is not converted either so it must be encoded in ASCII or UTF8 as required. APR and HTTP APIs as of V5R4, expect data in UTF-8. Note that several APIs have additional functions that allow a CCSID to be set to indicate the encoding of the parameters being passed. Conversion functions between UTF-8 and EBCDIC have been added. Be sure to review APIs used by your module to be aware of current changes.
Follow the below directions to compile and use a new module.
1. Save the source code
Save the source code in your QSYS or IFS directory. All objects created from compiling and creating the service program must be placed in the QSYS directory.
2. Compile the source code
Compile the source code using the CRTCMOD command. Before you compile the program, make sure you have the correct programming language compiler installed on your iSeries™ (the most common programming language used is C). Replace the text in the parenthesis ( ) with your own information.
CRTCMOD MODULE(Destination module name and library for the compiled module object.)
CRTCMOD MODULE(MYLIB/MOD_TEST) SRCSTMF('/mydir/mymodule/source/mod_test.c') DEFINE(AS400 AS400_UTF8) LOCALETYPE(*LOCALEUTF) TERASPACE(*YES) INCDIR('/qibm/proddata/httpa/include')
CRTCPPMOD MODULE(MYLIB/MOD_TEST) SRCSTMF('/mydir/mymodule/source/mod_test.c') DEFINE(AS400 AS400_UTF8) LOCALETYPE(*LOCALEUTF) TERASPACE(*YES) INCDIR('/qibm/proddata/httpa/include')
Correct any errors found while compiling. Continue to compile the source code until there are no errors. Save the compiled module in the QSYS directory.
3. Create a service program
Create a service program using the CRTSRVPGM command. Replace the text in the parenthesis ( ) with your own information.
CRTSRVPGM SRVPGM(Destination service program name and library.) MODULE(Module or modules to be built into the service program. Same as CRTCMOD above.) EXPORT(Name of the data item to be exported.) BNDSRVPGM(Specifies other service programs needed to bind to when creating the service program.)
The BNDSRVPGM field must have, at a minimum, the following: (QHTTPSVR/QZSRAPR QHTTPSVR/QZSRCORE QHTTPSVR/QZSRXMLP QHTTPSVR/QZSRSDBM ). These values will cover all the HTTP Sever (powered by Apache) APIs that may be used when building the service program.
4. Add LoadModule to HTTP Server (powered by Apache) configuration file
Using the IBM® Web Administration for i5/OS interface, manually add the LoadModule directive to your HTTP Server (powered by Apache) configuration.
LoadModule Module /QSYS.LIB/PATH/MODULE.SRVPGM
Example (replace MYLIB.LIB with your library name):
LoadModule footer_module /QSYS.LIB/MYLIB.LIB/MOD_FOOTER.SRVPGM . . . <Directory "/www/mydocs/htdocs"> SetOutputFilter FOOTERFILTER FooterFile footer.hf </Directory>
The FOOTERFILTER output filter and the FooterFile directive are defined in MOD_FOOTER, the module that was compiled and configured.